Changing upload_max_filesize on PHP

后端 未结 11 817
星月不相逢
星月不相逢 2020-11-22 16:50

I\'m using PHP 5.3.0 and have encountered something that might be a bug (in which case I\'ll report it) or might be me - so I\'m asking to make sure.

When running th

相关标签:
11条回答
  • 2020-11-22 17:06

    You can use also in the php file like this

    <?php ini_set('upload_max_filesize', '200M'); ?>
    
    0 讨论(0)
  • 2020-11-22 17:07

    By default, PHP permits uploading maximum 2 MB file on the server. But you can modify the maximum size of file upload as per your condition. By using the PHP configuration file php.ini, you can increase or decrease the file upload size in PHP.

    First open the php.ini file in your text editor. Search the upload_max_filesize variable and stipulate the size which you want to increase.

    Search for post_max_size variable and stipulate the size which you want to increase.

    post_max_size = 128M
    

    you can check this from here

    0 讨论(0)
  • 2020-11-22 17:13

    Since I just ran in to this problem on a shared host and was unable to add the values to my .htaccess file I thought I'd share my solution.

    I made an ini file with the values in it. Simple as that:

    Make a file called ".user.ini" and add your values

    upload_max_filesize = 150M
    post_max_size = 150M
    

    Boom, problem solved.

    0 讨论(0)
  • 2020-11-22 17:18

    I've faced the same problem , but I found out that not all the configuration settings could be set using ini_set() function , check this Where a configuration setting may be set

    0 讨论(0)
  • 2020-11-22 17:21

    I got this to work using a .user.ini file in the same directory as my index.php script that loads my app. Here are the contents:

    upload_max_filesize = "20M"
    post_max_size = "25M"
    

    This is the recommended solution for Heroku.

    0 讨论(0)
提交回复
热议问题