Server issue with large file upload? - php

I have a dedicated server Linux WHM/Cpanel that hosts a video streaming website. I have a form to upload videos and I've been trying to upload larger files but failing? I've checked error logs and nothing is leading me in the right direction. Below are my php.ini settings
upload_max_filesize = 1200M
post_max_size = 1200M
max_input_vars = 1000
memory_limit = -1
max_file_uploads = 20
max_execution_time = 7200
max_input_time = 7200
max_input_vars = 1000
I can upload a 100MB file just fine but the movies i have can be up to 1gb. I'm using Plupload to upload files. I've tested several small size files and they upload fine. When I try to upload large movies e.g. 300mb, Plupload returns this error HTTP Error. Upload URL might be wrong or doesn't exist. and this is the only clue I have. Plupload uses chunking to split up large files also.
This only happens with larger files. It's really a nuisance also, since I have to upload large files all over again to see if my changes are successful or not.
Any ideas? Why would it work with a smaller size file but not larger? I have no errors to work from.

HTTP Error is common when there is something wrong with the files being uploaded. Please check your server info with php.ini
upload_max_filesize is the limit of any single file.
post_max_size is the limit of the entire body of the request,
Sometimes the server requires post_max_size greater than upload_max_filesize I might be wrong but I have to check.
Try debugging the issue removing the chunking first and then later add the chunking part when you remove those HTTP errors.

Related

Uploading a specific photo causes ERR_CONNECTION_RESET, PHP

I have a page on my website that I can upload multiple large photos to through an html form, processed with PHP. Everything works great - I am able to upload dozens of files at once (my max so far has been about 150).
However, there have been two separate instances where I got the dreaded ERR_CONNECTION_RESET error because of ONE image in the bunch. I don't think there is anything different about the image... it's the same file type and was taken on the same day by the same camera with the same dimensions and DPI.
I tried to upload that one image by itself, but I got the same error. Here is the photo for you to examine if necessary.
My php.ini file:
file_uploads = On
max_file_uploads = 300
max_execution_time = 999999
max_input_time = 999999
post_max_size = 80M
upload_max_filesize = 80M
memory_limit = 50G
What could be so different about this image that would cause it not to upload?

Increasing the Upload Limit of my PHP script

I have a simple PHP script. Its used to upload users into the joomla tables. Basically it uploads users into joomla three main tables.
The PHP uploader sript works fine when the CSV is about 80MB to 100 MB.
It does not work or just nothing happens when the file size is 500MB or above.
How do i make the PHP script work to upload the CSV files of over 500 MB?
Do i actually change something in my PHP.ini settings or is there something else i could
add in the script itself.
Thanks in Advance.
in the .htcaccess file add the following:
php_value upload_max_filesize 500M
php_value post_max_size 500M
in php.ini add:
upload_max_filesize = 500M
post_max_size = 500M
You have to change the upload_max_filesize in php.ini
I had the same issue long time ago with rails and mysql,
You have to consider 3 things when you want to upload a file:
Max upload file in PHP
Be sure that MySQL will save a big file.
Your browser will lost connection after a while uploading a file to your database if it don't receive any answer from the server.
I think that You handled the first 2, but to handle the 3rd probably you will need a upload progress bar to keep the session active. Actually you need some AJAX to keep the server and the client "talking" meanwhile the file still uploading.

Uploading video files to IIS 7 through php fails

I'm trying to get my website to upload video's and pictures. As I have made more websites that upload pictures there is no problem on that front, but when i try to upload a video for some reason it can't be found in the $_FILES array that contains an uploaded image.
I have already googled and found stuff about the php.ini file and IIS 7 containing max sizes for uploads. these are all set to 1024M:
In php.ini:
max_execution_time = 1000
max_input_time = 1000
memory_limit = 256M
upload_max_filesize = 1024M
post_max_size = 1024M
In IIS 7:
maxAllowedContentLength = 1073741824
maxRequestLength = 1073741824
After some testing it appears that really small video files do work (192KB) but somewhat bigger doesnt show anyting in the $_FILES array (11MB) but really big files (80MB) gives an error: The request filtering module is configured to deny a request that exceeds the request content length.. The problem is that i have set the maxAllowedContentLength to 1GB. So that shouldn't happen?! An image of this is down below:
Image
Any help or advice is greatly appriciated!
The answer was given on ServerFault: ServerFault - Uploading video files to IIS 7 through php fails. Hope this helps if you have this same problem.

un-explainable problem with file uploads

Everything was fine with my file upload script until I decided to upload larger files and by larger files am talking about just 2mb talk more of a 30mb file. I have been to my php.ini to change the following:
post_max_size = 100M
upload_max_filesize = 120M
The memory limit was left # d default 128M
after all this settings it still did not work, it shows this error message
"file could not be written to disk"
Some friends suggested that it had something to do with d permissions but I doubt that because the same script works for smaller files 600kb and below. I can't really explain what is going on. Any help would be appreciated.
If linux, check your quota for the user.
Maybe your disk is full.
I had this problem and fixed it by increasing the size of the tmp folder. Check the tmp folder size and make the size is big enough.

1GB file upload using php

I am trying to upload a file of 1GB size using php script and it works perfectly if file size is less than 20MB, but when I increase the file size than after pressing upload button on website, it uploads the file (I guess as it takes few minutes) and after that, instead to execute upload.php, my firefox asks me to download upload.php, so I guess, file is being uploaded but my php script fails to execute.
Also after searching in google I found following settings for php.ini which I made and my php_info() function shows me that settings have been changed..
/*php.ini start*/
memory_limit = 512M
post_max_size = 15000M
file_uploads = On
upload_max_filesize = 15000M
max_input_time = 20000
max_execution_time = 20000
session.gc_maxlifetime = 20000
/*php.ini end*/
The limit on file size uploads is limited by a LOT more than just PHP. PHP has its limits, Apache has its limits, many web services have their own limits, and then you have the limit on the /tmp directory size which could be set by user permissions on a shared host. Not to mention just running out of hard drive space!
Your php.ini looks good, but as was already suggested- check the LimitRequestBody in Apache and make sure your web service allows this.
One common solution when you need to upload very large files is to use Flash or Java on the client-side since these have access to the client's actual file system. The Flash/Java can then break the file into small pieces which are sent one at a time and re-assembled on the server side. This has multiple benefits. First, you can resume broken downloads. Second, you don't have to worry about any scripts timing out. Third, it bypasses any possible file system limits that may be in play from PHP, Apache, web services, or other sources.
post_max_size = 15000M should be higher than upload_max_filesize = 15000M.
It can be either post_max_size = 15001M. I've increased it to 1 more.
Check that your web server also allows such large uploads. On Apache the setting is LimitRequestBody. This limit is be applied long before PHP ever enters the picture and cannot be changed/overriden from within PHP.

Categories