when I try upload images larger than 2MB, I get the following error message:
server responded with 500 code
in header:
Request URL: http://mydomain.com/filemanager/upload
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: 127.0.0.1:80
Referrer Policy: no-referrer-when-downgrade
my confog and php.in is:
lfm.php:
'max_image_size' => 50000,
'max_file_size' => 50000,
php.ini:
upload_max_filesize=500M
post_max_size=500M
max_execution_time=900
memory_limit=256M
max_input_time=900
please help me :(
what kind http server you use?
if you use nginx, maybe you need to set client_max_body_size.
if you use apache, you should set upload_max_filesize, post_max_size,
thank you. I use apache and set in php.ni "upload_max_filesize=500M , post_max_size=500M" but get error when upload images larger than 2MB.
I test in my host and in local. This problem exists in both!
I guess this problem is not in php.ini settings and is related to the file-manager.
I Need to help....
how to I test it without Ajax? An error may be displayed without ajax.
I used thid form:
<form action="http://mydomain.com/filemanager/upload" role="form" id="uploadForm" name="uploadForm" method="post" enctype="multipart/form-data" class="dropzone">
<input type="hidden" name="working_dir" id="working_dir" value="/shares">
<input type="hidden" name="type" id="type" value="image">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="file" name="file" id="file">
<input type="submit">
</form>
get this message:
["You must choose a file!"]
I change name and id from file to attachment. now upload form work. I tested a 10MB file , But the file could not be uploaded like AJAX, and displays the following error:
This page isn鈥檛 working
www.mydomain.com is currently unable to handle this request.
HTTP ERROR 500
please help me :(
I found the problem. The problem is exactly with this part of the code:
if (parent::fileIsImage($file) && !in_array($file->getMimeType(), ['image/gif', 'image/svg+xml'])) {
// Handle image rotation
Image::make($file->getRealPath())
->orientate() //Apply orientation from exif data
->save($new_file_path);
// Generate a thumbnail
if (parent::imageShouldHaveThumb($file)) {
$this->makeThumb($new_filename);
}
} else {
Exactly this part:
Image::make($file->getRealPath())
->orientate() //Apply orientation from exif data
->save($new_file_path);
when I remove this part, image upload successful but thumb is not created.
Why does this part of the code give error 500 for big photos?
I add this code to uploadController.php:
error_reporting(E_ALL);
ini_set("display_errors", 1);
and get this error :
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 21844 bytes) in C:\test\project\testProject\vendor\intervention\image\src\Intervention\Image\Gd\Decoder.php on line 136
What should I do?
I change memory_limit from 256M to 500M and my problem sloved!
馃憤
A 500M memory is great for image rotation of a 11M photo. Most hosts have a memory limit of up to 250 MB. WordPress without problems with 250 MB of memory.
Please optimize the resizing code.This is a huge constraint for our customers!
Many coders have reported that they use a lot of RAM and this is not acceptable for hosting. sample:
https://github.com/Intervention/image/issues/781
It's best to use another way to manage images.
Thank you @nekooee , we will keep this in mind.
Hi, I got the same problem laravel-filemanager::lfm.error invalid
I have installed exif and fileinfo on my server.
I don't found another solution :/.
Thanks.
@hanabalonch please check exception messages in storage/logs/laravel.log. If you need further discussions, please open a new issue.
I have added summary of this issue to our wiki, closing issue.
Most helpful comment
I change memory_limit from 256M to 500M and my problem sloved!
馃憤