开发者

How to allow more than 2 Mb limit with PHP on a shared hosting service?

by default PHP will 开发者_运维知识库not handle file uploads larger than 2MB, if one requires PHP to handle larger files then one must set upload_max_filesize and post_max_size in your php.ini file to be larger than 2MB.

what alternative if one uses a shared hosting service with no access to php.ini ?


With ini_set you can dynamically change PHP configuration. But it is very possible that your provider will not allow you to do that.


File uploads are handled before the script starts running so setting parameters with ini_set() will not work. All serious providers offer a way to customize your PHP settings. The exact mechanism should be explained in their help system and it depends on the server API:

  • If PHP runs as Apache module, you can use the php_value and php_flag directives in an .htaccess file.

  • If PHP runs as CGI (or FastCGI), you should have a custom php.ini file somewhere in your account.

Some of the settings you may need to change are (.htaccess version):

php_value max_execution_time 1200
php_value max_input_time 1200
php_value memory_limit 128M

php_value post_max_size 50M
php_value upload_max_filesize 50M


hosting Control Panel, if any

.htaccess file

php_value upload_max_filesize 10M

but it can be restricted too.
anyway, such questions better to be addressed to the hosting support


The alternative is a bit long winded, but will work.

You need to implement chunked uploads with a flash component handling the data transactions. Look into something like "Uploadify" - although this particular plugin will not (as far as I know) do chunked uploads. Its a start, but you'll need to find a flash component that will do this, or get a flash developer to make one for you.

e: first try to set the upload limits directly using the methods described here, but if the host has locked this option, then above will be plan b =)

ee: found a component that does this - http://www.plupload.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜