Unable to upload file to WordPress

Have you ever tried uploading an image to your WordPress site and run into the following error:

Looking at what the error means, is basically a PHP limit which sez you not allowed to upload files bigger than 2MB.

As per google, it means the following(Basically the same):

The default values for PHP will restrict you to a maximum 2 MB upload file size. On the settings page for the upload module, Drupal calculates and displays the maximum file size that you can set based upon two PHP settings: ‘post_max_size’ and ‘upload_max_filesize’.

To resolve the issue, do the following:

-ssh into your instance and navigate to the php.ini file. The path to my file was the following

/etc/php.ini

Using a text editor, open the file:

sudo vim /etc/php.ini

Locate the following:

 

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2M

 

Edit the “upload_max_filesize = 2M” and change this to your desired size as seen by the change I made below:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 10M

Save the change and exit the text editor.

Restart your webserver just for restart sake.

Attempt uploading the file again and boom, it should work now.

 

No token or token has expired.

Leave a Reply

Your email address will not be published. Required fields are marked *

RAID

9th Aug 2018