File upload exceeds upload_max_filesize

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
dpmiller
Forum Newbie
Posts: 6
Joined: Tue May 25, 2010 7:54 pm

File upload exceeds upload_max_filesize

Post by dpmiller »

When trying to upload a .jpg file that is over the upload_max_filesize limit set on my server I get the following error and the filesize shows to be zero:

Warning: copy() [function.copy]: Filename cannot be empty...

My php settings are:
post_max_size 8M
upload_max_filesize 2M

My php code checks for file sizes over 1M and works if the filesize is under 2M but if they are over 2M I get the php error message mentioned above and again the filesize shows to be zero.

Does anyone know how to test for this so the error message does not appear?

Any help would be greatly appreciated.

Thanks.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: File upload exceeds upload_max_filesize

Post by requinix »

One of the first things your script needs to check is for errors.
dpmiller
Forum Newbie
Posts: 6
Joined: Tue May 25, 2010 7:54 pm

Re: File upload exceeds upload_max_filesize

Post by dpmiller »

Thank you tasairis that helped alot. As you can tell I am a bit of a newbie.
Post Reply