Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

I found "php.ini" but...

Using the "php.ini" file I have

(1) changed the post_max_filesize from 8M to 1000M; and (2) changed the upload_max_filesize from 5M to 1000M.

I have restarted XAMPP and the changes can be seen on the admin's media page...

...however, I am still getting the following error:

Maximum upload file size: 1000MB. Dismissโ€œ015.gifโ€ has failed to upload due to an error The uploaded file exceeds the upload_max_filesize directive in php.ini.

Does anyone have any insight on how to solve this matter?

1 Answer

Lucas Krause
Lucas Krause
19,924 Points

PHP doesn't support an option called "upload_max_size". The option you are searching for is called "upload_max_filesize". ;)

Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

...that was a typo that I had written above..."filesize" is in fact what is used in my ini.php file.

Sorry about that...

Do have any insight on how to fix this problem?

Lucas Krause
Lucas Krause
19,924 Points

When you write "I have restarted XAMPP" I think you mean that you restarted the Apache, do you? If not, do so.
The error message doesn't seem to be an original PHP error message, rather a WordPress error message. I'm not sure if it describes the problem perfectly. Maybe the error doesn't happen due to your "upload_max_filesize" setting but due to another setting like "memory_limit" which can be reached really fast when uploading an processing huge files. Other related settings are "max_execution_time" and "max_input_time".
Moreover you can set a file size limit for file uploads using an input field with its name attribute set to "MAX_FILE_SIZE".

Unfortunately I can't think of other potential error sources.

Lucas Krause
Lucas Krause
19,924 Points

Hm... Maybe it's actually not the php.ini but a .htaccess file?

Lucas Krause
Lucas Krause
19,924 Points

Just place the .htaccess file inside of the directory containing your PHP file and add the following line to it:

php_value upload_max_filesize 1G

You can also set boolean settings using php_flag and add comments using a #.
Please note that you can't set all settings using a .htaccess file, see PHP documentation for more information about the different options.

Carla Thomas
seal-mask
.a{fill-rule:evenodd;}techdegree
Carla Thomas
Front End Web Development Techdegree Student 16,039 Points

Thanks for your patience with me Lucas...

Two questions:

(1) Do I create a .htaccess file; and (2) Is there a more specific name for the "PHP" file that is mentioned above?

Carla

Lucas Krause
Lucas Krause
19,924 Points

Hi Carla.
Two answers:

  1. I don't know whether you did create a .htaccess file. If you want to create one you can simply create a new file, write "php_value upload_max_filesize 1G" (for example) to it and save it as ".htaccess" (without any file extension) in the directory containing your PHP file (see below) or one of its "parent" directories.
  2. The PHP file you are requesting.
Lucas Krause
Lucas Krause
19,924 Points

Maybe you should also watch this video at about 4:20 ;)