Forum Moderators: coopster & phranque

Message Too Old, No Replies

input type="file" probs

         

gerritgiliomee

10:45 am on Jul 19, 2001 (gmt 0)



Hia,

I'm trying to use a "customized" version of <input type="file"> by hiding the element and providing a textbox and clickable image to do the actual upload.
When clicking the image, I fire the .click() event of the <input type="file"> element and the dialog box for selecting files opens up and allows me to pick a file for upload.
However, when I try and submit the selected file, the <input type="file"> element clears it's contents. Any reason for this? Has anybody had the same problem?

-G

bobriggs

3:52 pm on Jul 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My guess?

It's probably related to a security fix that IE and probably NS made, in which you cannot preload a value into an input type="file" tag. The reason for this is that a web page could preload a named file that is common, or might be on a user's computer (email, passwords, anything you can think of that a cracker might want), put a submit button in there (go to next page) and the file gets uploaded.

So my guess is that if the browser doesn't get the file 'value=' exactly the way it wants to, anything you put in there is discarded.