dstwfcz1377
2015-07-10 17:20 阅读 76
已采纳

增加上传文件大小cakephp 3

I want to upload files larger than 50 MB but only accepts less than 3 MB, how can i increase this limit?

already try adding the following in .htaccess:

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]    
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value memory_limit 100M

the problem was here in php.ini:

upload_max_filesize = 1000M   
post_max_size = 1000M

Thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    dongtu1789 dongtu1789 2015-07-15 21:36

    the problem was here in php.ini:

    upload_max_filesize = 1000M   
    post_max_size = 1000M
    

    Thanks

    点赞 评论 复制链接分享
  • dongling5411 dongling5411 2015-07-10 17:42

    Try this:

    <?php
        error_reporting(E_ALL);
        ini_set('upload_max_filesize', '100M');
        echo ini_get('upload_max_filesize'); // 100M
    ?>
    

    If the output equals 100M php is configured properly and the size limit is enforced by the php script (laravel), if not the host doesn't allow increasing the file limit that high.

    Either way I advise you to upload huge files in chunks with libraries like Plupload. It is less prone to errors and timeouts.

    点赞 评论 复制链接分享
  • dqed19166 dqed19166 2015-07-10 17:47

    It looks like an Apache httpd configuration (you don't specify); but you might be running into the server limitation before you're running into the PHP limitation:

    From the Apache Core documentation, try adding the following line to your .htaccess file (or set it at the server level):

    LimitRequestBody 50000000
    

    ("50000000" or the exact byte value you wish to use.)

    点赞 评论 复制链接分享

相关推荐