?
Solved

Default value in browse button

Posted on 2003-02-25
8
Medium Priority
?
181 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
  • 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

621 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