0

I have an image upload form for a client that I am having an issue with. I wish to set the file size to a maximum of 5.1 mb. However everything over 2.0 mb fails my if statement. below is the portion of the code I am using to qualify the file size. Are there limits to file size handlers that I am not aware of or does anyone see anything wrong with this expression? I am sure the expression is correct, as it works perfectly fine for images under 2mb. Thanks in advance.

if (($_FILES["file"]["size"][$i] < 5100000)     
                && in_array($file_extension, $validextensions)) 
1
  • yes, I have various test files that I am using with different file sizes ranging from 1.98 to 2.02mb. Commented Sep 21, 2016 at 19:28

1 Answer 1

1

Did you check your php.ini? The default upload_max_filesize is 2MB.

Sign up to request clarification or add additional context in comments.

2 Comments

I have, I changed it to 6mb. is that an instant affect type thing, or do I need to restart the server for it to take effect?
Yes, you need to restart your web server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.