?
Solved

Default value in browse button

Posted on 2003-02-25
8
Medium Priority
?
177 Views
Last Modified: 2012-05-04
Hello,
I can't manage to display a value in the browse field
(it work with all other kinds of fields):

<? $real_path = realpath ($JinglePathWAV); ?>

<? echo $real_path ?> // it works

<input type="file" name="jinglepath"
style="font-face : Arial, Helvetica, sans-serif ;
font-size : 9px" id="JinglePath"
value="<? echo $real_path ?>" size="35">//doesn't work:-(


// it doesn't work either with value="aaa"

according to the specs:

http://www.w3.org/TR/html4/interact/forms.html#h-17.4

"17.4.1 Control types created with INPUT
The control type defined by the INPUT element depends on the value of the type attribute:
...
file:
Creates a file select control. User agents may use the value of the value attribute as the initial file name"

so it surely possible but I don't know why it doesn't works... I'm open to any suggestions!
0
Comment
Question by:Phil_CH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 80 total points
ID: 8016397
The value attribute is valid, but for security reasons, it is read-only to the script engine ... that is, only the user can give it a value.  Otherwise, there would be nothing to prevent this:

<BODY onload='document.forms[0].submit();'>
<FORM action='whatever.php'>
<INPUT type='file' value='C:\winnt\system32\mypasswords.txt'>
</FORM>

In other words, there is no way to modify the value attribute of a FILE input using Javascript because it would be a major security violation.  Only the user can change the value.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8016410
however, as vettranger pointed out, there may be some third-party controls (ActiveX,Applets) that will allow you to do this.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8016430
also, in the specs you cite, apply only to input types of text, radio, checkbox, button, and hidden -- with respect to the value attribute.  (input type=file does not apply)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:Jonza
ID: 8016448
i think it isn't possible, because the purpose is that client itself chooses the file location.

i tried to change it with javascript but that didn't work either..

my answer is: NOT POSSIBLE... sorry.
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8016458
damn, you were faster :)
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8820422
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 33

Expert Comment

by:knightEknight
ID: 8823984
This question is surely in the PAQ already, but still, our answers are correct.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9011937
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to knightEknight  -- grade A

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question