I have a problem, where I get 500 internal server error when I try to upload an image that is too big in dimensions. The application works fine on one server and throws 500 internal error on the other. In both cases the application is on shared hosting but I do have some influence on hosting providers :)
So the problem is not the weight (MB) but the dimensions (px). Everything over ~1600px width, throws an error. The problem is that I cannot resize the image in PHP before I get the error. Because the app runs fine on one server and not on the other I presume it is some server restriction similar to one with weight (MB). Giving the user a custom error doesn't resolve the problem, because most users do not know how to resize the image.
Has anyone seen this kind of problem? Could this be some php.ini setting or something else?
#user805528
in order to tackle that issue, you need to grab the image, save to a stream (probably file system or php streams) and then calculate its dimensions using getimagedimensions
https://www.php.net/manual/en/function.getimagesize.php
In case your image doesn't meet your validation criteria, you need to throw an error to the end user and remove the image.
In any other case you can accept your image any way you would normally.
I would say that a webserver doesn't restrict image uploads by dimensions.
If you are sure that there's not some PHP function restricting the upload by image size in the code, I would suggest increasing these values in your server's php.ini file:
upload_max_filesize / memory_limit / post_max_size
Related
This is not a quick failure, I have spent a totally of 5 completely full days trying to figure this out. Initially I was limited by file size and then file type; in which I removed the Wordpress restrictions and am now "capable" of uploading my 177MB .glb file to Wordpress.
However when doing so, I receive the following error:
retriever.glb
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
I was on the phone with GoDaddy Specialists for 2.5 hours yesterday ensuring that this was not a Server issue or restriction on their side.. they confirmed that it was not. We pretty much ended the conversation that it is something I must figure out with me, myself, and I.
I went ahead and uploaded my .glb to the server through panel, everything worked fine. In fact I have a location for it here: https://www.tattiniboots.com/wp-content/uploads/2020/07/retriever.glb
However, this does not make the file discoverable to the 3D viewer plugins I have installed on the site through the media location.
I truly don't know where to go from here
I changed the name of the file to .png and attempted an upload and received the following error:
Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.
I just tried to update a normal .mov file that is 150MB and received the following error; really making me think this is something to do with file size:
Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.
Yes, normal images are uploading just fine (2MB-ish)
I just attempted to deactivate all plugins with consideration that maybe "Smush" or another was imposing issues: I then received the issue that the file type is not supported (even with the allow all file types code in my wp-config)
Is this just the case that glb is not allowed at all?
This must be a server thing. probably a run time error
Whoever supported you just doesn't know it. GoGoDaddy. ;)
Nevertheless... you can Use a plugin that's called
media sync. Check it out and best of luck
I am uploading more than 12 images files for a single requests but the online server refuses to upload those images. In my local machine it works fine, i can upload more than 20 images at once. I have configured the PHP settings for max_file_uploads = 60, upload_max_filesize=100M, post_max_size = 125M in php.ini, both on my local machine server and online server. While sending the page loads unfinishing, and at the end after a long time it responds with a Network Protocol Error, which says that:
"An error occurred during a connection to www.mydomain.com. The page you are trying to view cannot be shown because an error in the network protocol was detected."
See the screen shots of other different error responses i've also got after many trials, and it still takes a long time of loading to get those responses after sending.
The images that i am uploading are being saved on server but not all. When i upload 20 images for a single request, it can get only 8 or 10 and sometimes the last image is cut short(interrupted) before it is fully uploaded, see its picture below.
I need to get all the images i am uploading like in my local machine, and with a quick response. What else i can do for configuration in PHP or elsewhere? What's wrong on shared hosting server? Please, if you have any answer to this, you can tell me what i can do, to get all uploaded images files with a quick response.
It's clearly because of a timeout error. It's not acceptable to send multiple files with one request. Even if you get it to work right now, it will fail from time to time depending on the user connection speed and file size. Also you mentioned a quick response. So you definitely need to use ajax upload to upload files simultaneously. There are multiple upload libraries such as dropzone.
We have a site on Wordpress and use Woocommerce for our commerce site. In short we have a front end form that logged in users can upload multiple images at once. Problem is these images are typically straight off a digital camera and we need to keep them at the highest resolution possible.
When users try uploading even 50+ images it takes FOREVER and sometimes doesn't even complete, it will return a 504 error.
We talked to the host and have done all we can with them to decrease server timeouts and they suggested making edits to the attached script. I also went in to the wp_config file and set the max upload size to something like 256M.
This problem is still happening and I was just wondering if anyone had any recommendations on how to prevent server timeouts or speed up image uploads without totally reworking the code?
The attached code is here: http://pastebin.com/AHTDNaDL
Just to save some time while browsing that file lines 3 -175 handle the product creation for each image uploaded; line 253 - 340 is the upload form and line 447 starts the binding functions.
I have been at this for days and googled everything from plugins to ajax uploaders but still not having much luck, thinking some outside input would help
Edit:
Since it doesn't look like I will be able to configure my server to what I need, is it possible to break the upload/creating of product up into a few different sections? In other words, the user would be able to upload all there images and then in the background I could run my create_var_product function to hopefully prevent timeout issues?
You need to edit your php.ini file. Look at editing at least the following:
max_input_time
upload_max_filesize
Check the documentation:
http://us3.php.net/ini.core
Try adding the following lines to the top of the script:
ini_set('max_execution_time', 10000);
set_time_limit(0);
ini_set('memory_limit', '-1');
I have a problem when attempting to upload really big files using PHP. I know this has been raised before and I have read many responses, but I have not found a definitive answer.
The basic code I use is posted here: http://design.wildsandwebdesign.co.uk/technical/uploading-files-2.php and I have used this with complete success for letting client upload image files, JPEG, GIF, png etc. The problem arose in allowing users to upload non-displayable files such as .psd files which can be very large.
In php.ini on both my local and remote servers upload_max_filesize and post_max_size are set to 128MB. The hidden field MAX_FILE_SIZE in the code has been set to various values during development. The problem is this: If the user selects a file bigger than the MAX_FILE_SIZE but smaller than 128MB,$_FILES['uploadfile']['error'] returns an error code of 2 as the PHP documentation says it will. If the file size exceeds 128MB then the upload handling fails altogether with bizarre results.
The “bizarre” results include irrelevant error messages such as “Undefined index: uploadbtn” this being the index of the submit button you have to click to get the error message(!) This happens with Firefox 26 and with Chrome. Bigger files can crash Firefox altogether which then displays the bug report dialog.
I don't want to upload files larger than 128MB, I just want to handle the situation where a user selects a very large file in some reasonable way. Does anyone know how to do this?
The production code is very much more complicated than the example above but I will happily provide it on request.
......
I built a website in that I upload 10 too big size(10MB) images. When uploading start, it continues to some time then a blank page will come. I tried to change php_values in .htaccess file, because I don't have permission to change the settings in php.ini file (it's shared server). I have some doubts regarding this.
1) what happen if file will going to post request, because I want fastly uploded the files.
2) it takes time when posting the request or uploding the file, I am cropping the images (loop) using php GD functions.
It is because of the limits your web hosting provider set. Which values did you try to change in the .htaccess?
You could try using some flash uploader, it should work despite the limits imposed by the server. A good one is SWFUpload.
That is because of the exection time of a script.You can edit your php.ini file. If that is not permitted you can set the *MAX_EXECUTION_TIME* for a script using your .htaccess file.