Jump to content

not allowing upload over 100kb - 200kb (estimation)


9three

Recommended Posts

Hi,

 

I have an uploader checking if the file is greater than 5mbs, if so display an error but it's not displaying an error nor is it uploading. It seems it works correctly for files around 200kb or less, then it just seems to stall...

 

if ($_FILES['file']['size'] > 5242880 || $_FILES['file']['size'] <= 0)
  echo 'File size too big or too small';
elseif ($_FILES['file']['error'] != 0)
  echo 'There was a problem with your upload';

 

Actually more around 95kb.

What does a phpinfo(); statement show for the value for the two settings? (in case the php.ini that you are looking at is not the one that php is using or the syntax being used for the settings is incorrect.)

 

The code you posted is NOT checking if the upload worked without any errors before it attempts to start checking pieces of the uploaded information. Read this link for the things you should be doing to make sure that the upload worked before you start validating any of the uploaded information - http://www.phpfreaks.com/forums/index.php/topic,285703.msg1354833.html#msg1354833

 

Also, posted in that thread is some debugging code to show the POST/FILES arrays so that you can see exactly what you are receiving as data.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.