...

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



Crazydog
08-01-2007, 10: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)
and

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?

Edit:
Got answer to first: I needed
$_FILES['thumb']['name'];
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

kbluhm
08-02-2007, 12:04 AM
<?php

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

?>

http://www.php.net/manual/en/features.file-upload.errors.php



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum