WordPress.org

Ready to get started?Download WordPress

Forums

Increase 2MB limit when uploading a Photo to a page (16 posts)

  1. egarywi
    Member
    Posted 2 years ago #

    Hi everyone, I have just installed WordPress on my MAC as a localhost.
    I am a keen photographer and I will use the final site for my photography
    All Photographs are over 2MB and rather than resizing them manually I have found a plugin to re-size them as you upload the image into WordPress. After they have been uploaded I will transfer the content and database to the web host.

    The problem I have is that WordPress has a restriction on the size of the file (2M) and will not attempt to upload the file in order for the plugin to take effect. I have read many posts however none of the recommendations have worked for me, I now seek your advice.

    I have tried the following:

    1.Modify the php.ini file in MAMP however it was already set to 32M for both:
    post_max_size and upload_max_filesize

    The location of the php.ini file in my installation is:
    MAMP/bin/php/php5.6/conf/php.ini

    2. Created a .htaccesss file in the wordpress root dir with the following:
    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

    In WordPress itself it has a txt line in the page that stipulates that the max upload filesize is 2M, is this fixed, are we able to change it?

  2. Chouby
    Member
    Posted 2 years ago #

    By default, WordPress uses the min value of post_max_size and upload_max_filesize options set in php.ini

  3. egarywi
    Member
    Posted 2 years ago #

    Yes that is what I have read, however the only php.ini file that exists is located in the MAMP directory for SQL which is set to 32M, there is no php.ini file in the WordPress installation at all.

    What dir do you believe the php.ini file that controls this parameter for WordPress belongs?

  4. Chouby
    Member
    Posted 2 years ago #

    Does the phpinfo reflect your changes ?

    I don't know MAMP. I use XAMPP (for which the php.ini is located in the etc directory).

  5. egarywi
    Member
    Posted 2 years ago #

    No WordPress still has a measage to say that the filkesize limit is 2m. This is stipulated on the page before you upload the photo. I tried uploading a photo greater than 2M and it creates an error.

    My original post gave the dir that he php.ini file is in MAMP and that it is set to 32M.

    Tell me does wordpress display the new setting on the page before uploading?

    I do not have an php.ini file in the etc directory, I have searched the whole computer and the only php.ini files are in the MAMP dir as specified in my original post.

    Any Ideas?

  6. Chouby
    Member
    Posted 2 years ago #

    Switch to XAMPP ?

    Did you restarted your server after having modified your php.ini ?

    I assure you that there is no hardcoded in WordPress and that it takes the min value of post_max_size and upload_max_filesize. you can look yourself at the code in wp-admin/includes/template.php at line 798 where the function wp_max_upload_size is defined. You will see that there is a filter 'upload_size_limit'. Maybe one of your plugin uses this filter to override the value set by WordPress.

    On my own local installation (XAMPP), one was 8M, the other 2M. I increased the last value to 4M and now WordPress tells me that the Maximum upload file size is 4M.

  7. ibullock
    Member
    Posted 2 years ago #

    You may also want to try changing the following in your php.ini:

    memory_limit = 1000M

    You might not need it at 1000, but you get the idea.

    I'm not sure of the differences between WAMP and MAMP, but on my WAMP installation there are two php.ini files, one in the php folder as you've noted, and one in the bin for Apache.

    As Chouby noted, make sure you restart your sever, or at least the PHP service.

    Something else to check are any .htaccess files for the site or the root directory. Upload size can also be affected by changes there. That being said, I've made my fair share of WordPress installs and never had that problem. The php.ini seems to be the typical fix.

  8. Ian (ibullock) please stop signing your posts. We don't permit it here, especially not linking to your site, and it's causing you to be caught as a spammer.

  9. egarywi
    Member
    Posted 2 years ago #

    Thanks Ibullock,

    The memory limit is also set to 3! I have restarted MAMP on every change.
    MAMP is the Mac version of WAMP, it seems that WordPress or MAMP is not reading the php.ini file properly. The file has 32M for both max file size and max post size, I tried the .htaccess solution as I explained in the original post without succes, now I have taken the file .htaccess out.

    At this stage I seem to have run into a dead end., any additional thoughts would be much appreciated. The photo upload size is still at stuck at 2M

  10. Chouby
    Member
    Posted 2 years ago #

    Did you check your phpinfo ?

  11. egarywi
    Member
    Posted 2 years ago #

    There are 3 x phpinfo files in separate directories
    1 bin.mamp - has vertually nothing in it
    2 bin/phpmyadmin - nothing that refers to max filesize
    3 bin/sql/plugins - has virtually nothing in it

  12. Chouby
    Member
    Posted 2 years ago #

    I did not ment any file but the php function. Just create a new php file and add this line:
    <?php phpinfo(); ?>
    Put this file in a directory you can access with your browser and open it with your favorite browser. You will see your configuration, including the two options post_max_size and upload_max_filesize. Thus you will see if your changes to php.ini are taken into account by your server or not.

    It should even give you the path to your php.ini

  13. egarywi
    Member
    Posted 2 years ago #

    Thanks Chouby,

    I do not know how to create a php file. If you could guide me through I would appreciate it.

    Other than that in the phpadmin web interface that comes with MAMP it has a tab which displays phpInfo both max_file_size and max_post_size as being 32M

    Does that help?

  14. egarywi
    Member
    Posted 2 years ago #

    Ok I found where the problem is, its something to do with the theme. Its actually adding the upload feature within WordPress which limits it to 2M.

    I will now tackle Photocrati, many thanks guys, have a good weekend

  15. haleeben
    Member
    Posted 2 years ago #

    I'm using WAMP which is the windows version of MAMP and the php.ini file I changed was located in wamp\bin\apache\Apache2.2.17\bin and I changed line 886: upload_max_filesize = 2M, changing this to 1000M got it up to 64M in the media uploads in wordpress, for a lot of people this will be enough but I've got some large video files to upload so I needed more, so I changed line 734: post_max_size = 64M to 1000M and it got me up to 1GB in the media uploads. Don't forget the restart the server after making the changes

    If your on a hosted server and you have this same problem you can try this;
    Create a php.ini file (with a text editor)
    with the following contents and upload it to the WordPress wp-admin directory :

    <?php
    memory_limit = 64M
    upload_max_filesize = 1000M
    post_max_size = 1000M
  16. mydanceguide
    Member
    Posted 1 year ago #

    Hey egarywi,

    I am also using Photocrati and wish to increse the 2MB photo upload limit. How did you go with this? Did you find a solution?

    Thanks, Chris.

Topic Closed

This topic has been closed to new replies.

About this Topic