View Single Post
  #2 (permalink)  
Old September 22nd, 2003, 08:30 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Nope. The browser prohibits you from setting an initial value because it's inherently insecure.

Consider the following example:
Code:
<body onload="document.Form1.submit();">
<form method="post" name="Form1">
<input type="file" value="C:\My Documents\MySecretFile.doc">
</form>
</body>
As you can see from this example, allowing an initial value in a file control, would allow you to upload any file (if you know the name) from your visitor's computer by having the form automatically submit when the page loads.

You also can't select a folder; all you can do with the <input type="file"> control is allow a single file. There may be third party controls available for this, but personally I don't know one that can do this.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.