skip to Main Content

I added the following to my .htaccess file, but still can’t upload the file.

php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value memory_limit 512M
php_value max_execution_time 600
php_value max_input_time 600

8

Answers


  1. Try adding set_time_limit to wp-config.php

    set_time_limit( 600 );
    
    Login or Signup to reply.
  2. Add the following code to your config.php file.

    @ini_set('upload_max_filesize' , '256M');
    @ini_set('post_max_size', '256M');
    @ini_set('memory_limit', '512M');
    @ini_set('max_execution_time', '600');
    @ini_set('max_input_time', '600');
    
    Login or Signup to reply.
  3. With a code or text editor, add the following code to your existing or new php.ini file:

    upload_max_filesize = 32M
    post_max_size = 64M
    memory_limit = 128M
    
    Login or Signup to reply.
  4. I think this is correct answer for your question
    Refer to following URL:

    Login or Signup to reply.
  5. Create or Modify the .user.ini File

    If your hosting provider has locked down the global PHP settings, they may have configured the server to work with .user.ini files instead of php.ini files.

    upload_max_filesize = 32M
    post_max_size = 64M
    memory_limit = 128M
    
    Login or Signup to reply.
  6. Increase the Max Upload File Size in Nginx

    On an Nginx server, you can find the php.ini file at /etc/php/7.4/fpm/php.ini. Depending on which PHP version you’ve installed, the exact path may vary slightly.

    upload_max_filesize = 64M
    post_max_size = 128M
    
    Login or Signup to reply.
  7. Use the WordPress ‘upload_size_limit’ Filter

    Below is an example of this filter in action from WordPress contributor Drew Jaynes. It defines the upload size limit for all non-admin roles.

    /**
    * Filter the upload size limit for non-administrators.
    *
    * @param string $size Upload size limit (in bytes).
    * @return int (maybe) Filtered size limit.
    */
    function filter_site_upload_size_limit( $size ) {
    // Set the upload size limit to 10 MB for users lacking the 'manage_options' capability.
    if ( ! current_user_can( 'manage_options' ) ) {
    // 10 MB.
    $size = 1024 * 10000;
    }
    return $size;
    }
    add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );
    
    Login or Signup to reply.
  8. Add the following code to your config.php file.

    @ini_set('upload_max_filesize' , '256M');
    @ini_set('post_max_size', '256M');
    @ini_set('max_input_time', '600');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search