Home > Net >  PHP Uploading video not possible due to post_max_size
PHP Uploading video not possible due to post_max_size

Time:12-24

Im trying to upload from js to my php script a video that is 600Mb large, but post_max_size in php.ini won't let me do that. I have no access to this file due to webhosting provider and I cannot change it in .htaccess. Is there any way of kind of evading this limitation and still upload a file, that is larger than the setting in php.ini?

CodePudding user response:

  1. You can set upload_max_filesize in script ini_set("upload_max_filesize", "600M")

  2. Use chunk uploading

CodePudding user response:

You can try it with .user.ini or .htaccess or ini_set(in your php script)

For me .user.ini works perfectly

1. Create a new file(0644 on Linux) .user.ini on your webspace/working dir with

max_execution_time = 10000

upload_max_filesize = 5000M

post_max_size = 5000M

This is my config file .user.ini on my webspace and it works.

You can change the values to your needs.

2. Create a new file(0644 on Linux) .htaccess on your webspace/working dir with

php_value upload_max_filesize 1000M

php_value post_max_size 1000M

! Don't forget the first dot/point at the beginning of the file.

3. Put this on the beginning of your php script

ini_set('upload_max_filesize', '1000M');

ini_set('max_execution_time', '1000');

ini_set('memory_limit', '128M');

ini_set('post_max_size', '1000M');

If this won't work(and you can't modify php.ini) than call your webhoster and ask him, what you can do :)

  • Related