php - Split large files to smaller chunks for uploading - php

I am making a website for uploading large video files using PHP. But the problem is that i get (ERR_CONNECTION_RESET) error while uploading large files which take more time to upload. It works fine for small files (less than 80-90mb) which take less time to upload. I have added these lines to my user.ini file but still nothing.
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M
upload_max_filesize = 1024M
Is there a way to break large files into smaller pieces which can be uploaded without this timeout error or is there any other better way for uploading large files.

you can use split command in Linux
https://linux.die.net/man/1/split

Related

Upload big file using PHP

I'm trying to upload big files using PHP and it's not working and the size is around 855 ko. I've already tried uploading smaller files and its worked so i'm sure that my problem that causing the error.
I've already tried most of the solution in SO and google but in vain. Some said that i should try to configure my php.ini and i did but without success.
I'm using lighttpd on an embedded system.
My php.ini configuration :
max_execution_time = 300; Maximum execution time of each script, in seconds
max_input_time = 25200; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 40M ; Maximum amount of memory a script may consume (128MB)
file_uploads = On
upload_tmp_dir =/home/imagesdcard/www/
upload_max_filesize = 10M
max_file_uploads=2
I had tried many solutions that suggesting it was caused by certains configurations in php.ini and i had changed it but without success.So, i wanna ask how can i upload big files using php?
Thank you in advance for all advice and help and have a great day.
By configuration, PHP only allows to upload files up to a certain size. There are lots of articles around the web that explain how to modify this limit. Below are a few of them:
PHP Increase Upload File Size Limit
How do I increase the PHP upload limits?
For instance, you can edit your php.ini file and set:
memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M
You will then need to restart apache.

Server issue with large file upload?

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.

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?

Upload large files on google cloud buckets

I'm trying to upload files to my bucket using this: https://cloud.google.com/appengine/docs/php/googlestorage/user_upload. I got it working but i can't upload files that are larger than 100 MB. The documentation says you can upload files up to 100 TB.
When I try to upload files larger than 100MB i get a request entity too large error.
Solved it. I had these 2 lines in my php.ini
upload_max_filesize = 100M
post_max_filesize = 100M
Changed it to
upload_max_filesize = 100G
post_max_filesize = 100G
and it worked.
When uploading larger files, you can consider the file to be chunked into small sets of requests that Google App Engine supports.
This package could help - https://github.com/pionl/laravel-chunk-upload

can not upload larger files

hello all i am having a dedicated server and even after increasing the max_upload size and memory limit i can not upload videos of larger size please check the image
i have a dedicated server from bluehost and the site is like video hosting site so i need to allow almost all file sizes but till now i have alloed max_file size arround 900 mbs but i can not upload files more than 10-20 mb please let me know if there is anything that i should do on my behalf.
By default, PHP permits a maximum file upload of 2MB. You can ask users to resize their images before uploading but let’s face it: they won’t. Fortunately, we can increase the limit when necessary.
Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, “10M” for 10 megabyte file sizes.
However, you also need to consider the time it takes to complete an upload. PHP scripts normally time-out after 30 seconds, but a 10MB file would take at least 3 minutes to upload on a healthy broadband connection (remember that upload speeds are typically five times slower than download speeds). In addition, manipulating or saving an uploaded image may also cause script time-outs. We therefore need to set PHP’s max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds).
These options can be set in your server’s php.ini configuration file so that they apply to all your applications. Alternatively, if you’re using Apache, you can configure the settings in your application’s .htaccess file:
php_value upload_max_filesize 10M
php_value post_max_size 10M
php_value max_input_time 300
php_value max_execution_time 300

Categories