I have spent hours reading about how to upload large files to a server. These video files will be in the hundreds of megabytes, and will be in .mp4 format.
My first attempt was using PHP processing a POST, but this was not working with files above two megabytes due to the restrictions in php.ini and httpd.conf.
Some users were simply increasing these limits to the levels they needed, and hoping the upload would work.
Some websites seem to be using flash uploaders, but the ones I have tried have been difficult, and never explicitly mentioned if they solved the upload size problem.
I have also looked at FTP using PHP as a client, but all the examples I found were simply transferring the file to an FTP server after it had been POSTed. FTP using a separate client is out of the question, as the file name and related data is stored in a database.
Currently, I am operating on localhost, and the site will be served from a box I have physical access to, but I am still wary of increasing the max_upload_size and related requirements because eventually I want to move to a hosted service.
What would be the best solution? Is there a way to do upload large files strictly through PHP and HTML? If not, what is the best solution to upload large files while still being able to pass the filename to a database?
Thanks to all who answer
The standard form-based file upload doesn’t work for you since files are uploaded in a single HTTP POST requests.
If you are looking for a solution built into the website, you should consider using some upload component which can shrink files to chunks client-side, send each chunk in a separate request and put together files on server. These components work as browser extensions. Even though everybody is obsessed with HTML5 these days and nobody likes Java applets and ActiveX components, Java/ActiveX suits best for your task.
I think that programming something using PHP will always end in the limitations of and HTTP file upload. I would use an app like Simple2FTP instead of trying to program something that is viable in PHP. http://www.simple2ftp.com uses a PHP script to handle users and manage files and JavaScript to do the actual upload via FTP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With