phpjavascriptfile-uploadupload

Uploading a large file with PHP/JavaScript?


I'm trying to enable uploads of up to around 12MB for a site, unfortunately using a basic form element like:

<input type='file' name='videofile' />

doesn't really seem to cut it, it seems to timeout after a certain period (I've tried upping the server variables, not sure if this is a browser thing).

Are there any readily available HTML5/JavaScript solutions that I can use here? I've tried Googling around but it seems there isn't much information around ... a few people have proposed Flash/Java applets, but that's something I really don't want to get into.


Solution

  • There are 2 directives you should alter in order to increase the allowed upload file size, these are: post_max_size and upload_max_filesize, so one would just post the below snippet of code in the php init script (index.php etc) in order to increase the allowed upload file size.

    ini_set('memory_limit','256M'); // this is optional.
    ini_set('post_max_size','64M');
    ini_set('upload_max_filesize','64M');
    

    L.E: If you are handling real big files, then you should consider chunking: Upload 1GB files using chunking in PHP