Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP File Upload problems when uploading "larger" (over 2MB) files

I am having problems trying to upload "larger" files, and I believe the limit that I'm allowed is about 2MB. I've uploaded multiple filetypes below 2MB (.js, .png, .jpg, .psd, .php), however anything over about 2MB fails.

  • 1.8MB psd image worked
  • 2.4MB psd image didnt' work (same file as 1.8, just bigger)

I've already changed php.ini to the following:

  • upload_max_filesize = 20M (changed this from 2M)
  • post_max_size = 40M (changed this from 2M)
  • max_execution_time = 60 (changed this from 45)
  • max_input_time = 180 (changed this from 30)
  • memory_limit = 48M (Changed this from 8M)

I've also added the following to my htaccess file in both the final directory where I'd like the file to be moved, and the initial directory where the upload form lives:

  • LimitRequestBody 53687091

Like I mentioned, the upload is working for smaller files, so I believe it has to be a restriction on the upload size, not anything wrong with the form.

Any ideas as to where I can look next? I want the limit to be 20M, it's all on our backend with a login required to access the page, so I am not worried about rouge uploads.

like image 291
Erik Avatar asked Oct 10 '22 02:10

Erik


1 Answers

Confirm that your upload_max_filesize / post_max_size is INDEED updated. Sometimes users don't know which php.ini file to edit.

Best way is to create file (that you delete later) and add the following code:

<?php
phpinfo();
?>

Run that file to get your system settings (search for upload_max_filesize, etc);

like image 151
Jakub Avatar answered Oct 13 '22 12:10

Jakub