Upload big videos from a form to server - PHP

496 Views Asked by At

I have to set up a form allowing the upload of videos whose weight is about 20GB for each.

This processing must be done in PHP.

I did a test with Plupload, but it does not work very well beyond 100MB: the file is uploaded, but its data is unusable (cf screenshot).

Do you have any recommendations/best practices?

Thanks.

enter image description here

2

There are 2 best solutions below

0
Rapkalin On BEST ANSWER

Just found the solution, in your .js file that handle the upload you just need to add the multipart option and to put the value to false :)

It means that the chunk should be sent as binary stream (ie. multipart : false) and not as multipart/form-data (default ie. multipart : true)

If need here is an example on how I handled video files upload with Plupload : https://github.com/Rapkalin/bigupload

Hope this helps :)

1
Bojan Vukajlovic On

At first point you need to make some changes in your php.ini configuration file. Look for upload_max_filesize, post_max_size, then you should look for max_execution_time, max_input_time. As i can see your file is missing an extension, easiest and fastest way to handle this is:

$strpos = strpos($file, '.');
if (!$strpos) return false;
$name = substr($file, 0, $strpos);
$ext  = substr($file, ($strpos + 1));

Now you can encode your name and append extension later. Also it will be good to paste your script or sample so we can look at it.