I have a form that looks something like:
<form enctype="multipart/form-data" method="post">
<input type='hidden' name='issue' value='06march'/><br/>
<input type="file" name='picture' size='45'/><br/>
<input type='text' size='40' name='caption'/><br/>
<input type='submit' name='upload' value='Upload'/>
<input type='submit' name='cancel' value='Cancel'/>
</form>
I have a PHP script that looks something like:
if( gpc( 'upload' ) ) {
print( "_FILES: " ); print_r( $_FILES ); print( "<br/>\n" );
print( "_POST: " ); print_r( $_POST ); print( "<br/>\n" );
$tmp_name = $_FILES['picture']['tmp_name'];
if( !is_uploaded_file( $tmp_name ) ) {
error( "'$tmp_name' is not an uploaded file." );
}
(The function gpc() just tries to get the argument from all three argument sources in order)
When I browse to a file and try to upload it, it prints the following:
_FILES: Array ( )
_POST: Array ( [issue] => 06march [caption] => [upload] => Upload )
Notice: Undefined index: picture in
/var/apache/htdocs/default/RPNS/upload/uploadpicture.php on line 18
Error: '' is not an uploaded file.
I have looked at the data sent from the browser with Ethereal, and it's sending the file alright (with a filename= attribute and everything). However, it doesn't show up in _FILES.
My php.ini claims that max file size is 4000000, and file upload is enabled.
Apache log doesn't show any errors (it shows up as a POST in access_log). Syslog does not show any errors.
This happens both with Firefox and IE. What am I doing wrong? What more should I check?