Input TYPE=FILE Error Checking

Jeff Zucker jeff at vpservices.com
Tue Nov 20 18:06:01 CST 2001


Aaron Kilbey wrote:
> 
> ... when i try to print back <INPUT TYPE=FILE NAME=bla
> VALUE="$querystring{bla}">.  The value gets written into the HTML, yet the
> input field in the browser is blank and a weird null file gets uploaded upon
> correct submission.  Basically, how do I re-populate that field everytime
> with the information that will produce the right file upon upload. - Aaron

To quote Lincoln Stein, from p. 150 of his book:

"...it is impossible to set a default value for a file upload field. 
This is because of concerns that malicious Webmasters could fool
unsuspecting users into uploading private or security-sensitive files to
a remote system.  For this reason, file fields are not sticky in the way
that other form fields are."

I suppose you could print back the original file location as a hidden
field and have javascript fill in the file upload field automatically or
something like that.  If that's possible (I haven't messed with
javascript for years so I don't know), then it's yet another security
hole in javascript :-(.  You could also just print it to a regular text
field and prompt the user to cut and paste it into the file upload
field.  A bit more work for the user, but better than them turning over
their hard drive contents to unknown webmasters.

-- 
Jeff
TIMTOWTDI



More information about the Pdx-pm-list mailing list