Modify Htaccess Wordpress for Max File Upload

Struggling with how to increase the maximum file upload size in WordPress?

The default max upload size value depends on your host, simply it can be quite low in some cases. This can upshot in y'all seeing errors such equally "The uploaded file exceeds the upload_max_filesize directive in php.ini" when you lot try to upload files to your WordPress site's Media Library or via other upload interfaces.

Thankfully, at that place are some fixes that you can apply to solve the problem.

In this postal service, we'll prove you several unlike methods that you can utilise to increase the maximum file upload size on your WordPress site.

Many of these methods will require calculation some code snippets to your site. Nevertheless, we will start with a uncomplicated plugin method that might piece of work depending on how your server is configured.

Here are the five methods that we'll cover:

  1. Costless plugin (code-complimentary)
  2. functions.php (lawmaking snippet)
  3. php.ini file (hosting dashboard or code snippet)
  4. .htaccess file (code snippet)
  5. Bonus workaround – upload files via FTP

Allow's get started!

How to Check WordPress Max File Upload Size

Before getting started, here'due south a quick mode to check your WordPress site's existing max file upload size.

In your WordPress dashboard, go to Media → Add New and expect for the Maximum upload file size value:

How to check the Maximum File Upload Size in WordPress

If this value is smaller than the file you're trying to upload, y'all now know why you're having issues.

How to Increase the Maximum File Upload Size in WordPress

Before we get started, I want to note that whether or not some of these methods work depends on your host's configuration. Nosotros cannot guarantee that all of the methods will work for your specific situation. Only we can say that they piece of work for many WordPress users and hosting configurations.

So, if you endeavour these methods and find that they don't piece of work for you, your next step should exist to reach out to your host's support. They might be able to override whatever is causing the problem.

With that caveat out of the way, permit'due south go into the tutorials…

1. Use the Free Increase Maximum Upload File Size Plugin

The absolute simplest pick to increase your max upload size is to use the gratis Increase Maximum Upload File Size plugin considering it doesn't require editing any code.

Notwithstanding, the plugin will only work up to the maximum upload limit set by your server. For that reason, it will but prepare the problem if the issue is that your WordPress site's upload limit is prepare lower than the server upload limit for some reason.

To bank check if it will work for y'all, install and actuate the costless plugin from WordPress.org. Then, become to Settings → Increase Maximum Upload File Size.

You'll see the max upload size from your server as well as your WordPress site's electric current site limit. You lot can and so utilise the drop-down to fix your site's max anywhere up to the server max:

How to Increase the Maximum File Upload Size in WordPress

If your server'due south max upload size is still likewise low, keep reading for some code-based fixes for that.

2. Use Child Theme'south Functions.php or Code Snippets Plugin

In some situations, you can increase your max upload size past adding the following lawmaking snippets to either your child theme'due south functions.php file or via the Code Snippets plugin (or some other similar plugin).

If y'all're adding information technology to functions.php, brand sure to use a child theme. Otherwise, your changes will be overwritten when you update your theme.

@ini_set( 'upload_max_size' , '32M' ); @ini_set( 'post_max_size', '32M'); @ini_set( 'max_execution_time', '300' );          

Yous tin change the numbers – '32M' – according to your needs. For instance, to make the max upload 64 MB, y'all could change it to '64M'.

3. Create or Edit php.ini File

The php.ini file controls basic PHP configuration variables, including the max upload size.

At some hosts, y'all might exist able to edit the php.ini file via cPanel, which is simpler than editing the file directly. For case, with Bluehost, you can open cPanel by clicking the Advanced tab in your Bluehost dashboard. And so, you tin select the MultiPHP INI Editor tool:

Bluehost php.ini editor

Then, y'all can select the site that you want to edit and conform the upload_max_filesize directive:

Changing the upload_max_filesize directive

If your host doesn't offer such a tool, you tin can try accessing the file straight.

Connect to your server'southward root binder using FTP or cPanel File Managing director (the root folder is the aforementioned binder that contains the wp-config.php file):

  • If you lot encounter an existing file called php.ini, edit that file. You might need to tell your FTP customer to show subconscious files.
  • If y'all don't see an existing file, create a new file chosen php.ini.

Then, add the post-obit lines of code:

upload_max_filesize = 32M post_max_size = 32M max_execution_time = 300          

Or, if you already see those lines of lawmaking, edit the numbers according to your needs.

4. Add Code to .htaccess File

If your host uses the Apache web server (which about WordPress hosts do), yous can try to increase your max upload size past editing your site'south .htaccess file.

To edit the .htaccess file, y'all'll demand to connect to your server using FTP or cPanel File Manager. And so, find the .htaccess file in the root folder (the same folder that contains wp-config.php).

Earlier making any edits, yous should download a copy of the file to your local calculator so that you have a safe backup in instance something goes incorrect (information technology's unlikely – but the .htaccess file is sensitive so yous ever want to have a backup).

Once you take a backup, edit the file and add the post-obit code:

php_value upload_max_filesize 32M php_value post_max_size 32M php_value max_execution_time 300 php_value max_input_time 300          

Once again, y'all can change the numbers according to your needs.

5. Talk to Your Host'due south Support

Once again, nosotros can't guarantee that these methods will work for all sites because sometimes your host'southward configuration but won't permit these tactics to work.

And so – if nothing has worked and then far, nosotros recommend that you reach out to your host'due south support to run into if they will increase your server'due south upload limit for you lot.

Workaround: Upload Via FTP and Import to WordPress

If nothing has worked so far and your host won't increment the max upload file size for you, I'll finish by sharing a workaround that y'all tin use to upload huge files to your WordPress Media Library.

This won't permanently fix the problem, just it will give you a way to get the file uploaded right away, which might be exactly what y'all demand right now.

Instead of trying to upload files via the WordPress dashboard, you can upload the file using FTP, which volition completely featherbed any file size limits.

To get started, use FTP to upload the file to the wp-content/uploads/… folder, making sure to select the correct yr/month.

For example:

/wp-content/uploads/2021/01/

At present, the file is on your server. Nonetheless, WordPress won't recognize it inside your Media Library even so. To gear up that, you lot can utilise the gratuitous Add From Server plugin to register the file that y'all uploaded to your Media Library.

After activating the plugin, go to Media → Add From Server:

Choose folder

Then, open the folder where you uploaded the file via FTP and import the files that you uploaded:

Import files

Once you import the file using the plugin, yous'll see the file in your Media Library merely every bit if you'd uploaded it direct via your WordPress dashboard.

For a deeper expect at this method, check out our tutorial on how to majority upload files to WordPress.

Increase WordPress Maximum File Upload Size Today

In this post, we've shared a number of different methods that you can use to increase your WordPress site's max file upload size.

For the simplest option, y'all should start with the complimentary Increase Maximum Upload File Size plugin. Still, remember that this plugin will only piece of work if your WordPress site's max upload is set below your server's limit – it can't increase the server limit by itself.

If the server limit is the problem, you'll need to try one of the lawmaking snippets that we shared. And if none of those work, you can achieve out to your host's support to come across if they can help you out.

Or, you tin as well get around this consequence entirely by uploading a file via FTP and and then using the Add together From Server plugin to import it to your Media Library.

For more tips on how to fix these types of WordPress issues, check out our guide on how to troubleshoot WordPress errors.

However have any questions virtually how to increment the maximum file upload size in WordPress? Ask us in the comments!

adamsdurtural.blogspot.com

Source: https://www.wpkube.com/how-to-increase-the-maximum-file-upload-size-in-wordpress-5-methods/

0 Response to "Modify Htaccess Wordpress for Max File Upload"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel