Page 1 of 1

[SOLVED]$_FILES isn't picking up my uploaded file.

Posted: Fri Mar 02, 2007 8:35 am
by impulse()
I have the following form:

Code: Select all

<form method = 'post' action = 'email_new.php' enctype='multipart/form-data'>
<input type='hidden' name='MAX_FILE_SIZE' value='30000'>
<input type = 'file' name = 'mailAttach'>
<input type = 'submit' value = 'Upload'>
</form>
But once the submittion has been made I only have the following data in $_FILES['mailAttach']:

Array ( [mailAttach] => Array ( [name] => pageant.exe [type] => [tmp_name] => [error] => 2 [size] => 0 ) )

Any ideas as to what's gone wrong. I can't find any error codes to explain "[error] => 2"

Posted: Fri Mar 02, 2007 8:37 am
by superdezign
Error 2 is when the file exceeds the MAX_FILE_SIZE in your form.

I'm sure that 30kb isn't enough for your executable file.

Posted: Fri Mar 02, 2007 8:38 am
by feyd

Posted: Fri Mar 02, 2007 8:39 am
by impulse()
upload_max_filesize 2M 2M
Although the exe file is 160KB. I have just tried to upload a 1KB text file but with the same results, and error.

Posted: Fri Mar 02, 2007 8:42 am
by impulse()
A-ha. It was the MAX_FILE_SIZE defined within the form. At least problem is now solved. I seem a bit embarrased that I've spent 1/2 of yesterday and all of today trying to figure it out. At one point I'd created 2 forms and 1 was showing the information OK and the other wasn't which lead me to believe there were unclosed forms somewhere so I had been scanning every line of code looking for any clue as to why this wasn't working. I should've shared my problem earlier on :).