Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set value of <input type="file">?

Status
Not open for further replies.

Naoise

Programmer
Dec 23, 2004
318
IE
I am constrained by the particulars of a given situation in having to do this, but can anybody help?

1) I have a directory which contains a script file.
2) This script runs and creates an upload form for each of the items in the directory. It sets the value property of the <input type="file"> part of the form to the path to that file ie "C:\foo\myfile.html"
3) So after all the forms have been generated into they are written to a html file which contains javascript to loop through all the forms in the page and submit them
one by one to a hidden iframe.

Problem
Nothing gets loaded into the iframe. If I actually click the <input type="file"> button on a frame and manually browse to a file and hit submit then my form is submitted
to the iframe. So everything else is fine, it is like you cannot set the value of this type?
 
You cannot do this by setting the "value" property - you have to use non-standard hacks. This has been discussed before many times... I suggest using the search facility to dig up some of those posts with solution.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top