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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

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

Post 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"
Last edited by impulse() on Fri Mar 02, 2007 8:43 am, edited 1 time in total.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post 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.
impulse()
Forum Regular
Posts: 748
Joined: Wed Aug 09, 2006 8:36 am
Location: Staffordshire, UK
Contact:

Post 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 :).
Post Reply