How to upload large files above 500MB in PHP [duplicate]

Solution 1:

Do you think if increasing upload size limit will solve the problem? what if uploading 2GB file, what's happening then? Do you take into consideration the memory usage of such a script?

Instead, what you need is chunked upload, see here : Handling plupload's chunked uploads on the server-side and here : File uploads; How to utilize "chunking"?

Solution 2:

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?
  • Uploading large(big) files in PHP using .htaccess

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.

Note:
That being said, Uploading large files like that is not very reliable. Errors can occur. You may want to split the files, and include some additional data for error corrections. One way to do that is to use par recovery files. You can then check the files after upload using the par command line utility on unix-like systems.