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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.