View Full Version : get "value" of file upload field

08-01-2007, 11:55 PM
I have a file upload field in my form.

I have two questions relating to it.

1) How would I validate it to make sure some type of file was chosen (type doesn't matter, just that the box wasn't empty)
(I tried:
if((empty($_FILES["thumb"]))){ but that didn't work)

2) How do I get the value of what was put in the field (the file path), so that it can be re-inserted into the file field via php?

Got answer to first: I needed
Second question: I read that value field doesn't work in file uploads...I can live w/o it, but if there is a way, I'd like to know

08-02-2007, 01:04 AM

if ( $_FILES['thumb']['error'] === UPLOAD_ERR_NO_FILE )
exit( 'No file was uploaded' );