View Single Post
  #4 (permalink)  
Old August 20th, 2004, 12:20 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Bob,

Although you cannot set the value of the <input type="file"> control, you can read from it.

What you could do is write a little JavaScript function that retrieves the value from the file field, and stores it in a hidden field. You can call this function on onblur of the file field, or when the user clicks a submit button, for example.

Then, at the server, you can retrieve the name of the file from the hidden field. You may need to reset the file field to prevent the actual upload of the file.

You can only have a user select a real file, not a folder. So, unfortunately, when you want your users to select a folder, you'll have to make them point to a file inside that folder, and then at the server extract the folder name from the file name.

With normal HTML, you cannot retrieve a picture from a camera. Maybe if you write an ActiveX control, you could do it, but I haven't tried
anything like that before.

If you need help with the JavaScript solution, let me know.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote