Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading Large Video Files to server, solution?

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

like image 647
Eagle Avatar asked Apr 12 '11 01:04

Eagle


2 Answers

The standard form-based file upload doesn’t work for you since files are uploaded in a single HTTP POST requests.

  1. Web servers cannot normally accept large HTTP requests.
  2. The upload process is long. If there is a connection problem, the user has to start over.

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.

like image 104
Dmitry Sevostyanov Avatar answered Oct 19 '22 04:10

Dmitry Sevostyanov


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.

like image 26
Henry R. Avatar answered Oct 19 '22 03:10

Henry R.