Våra läsare ber oss ofta att hjälpa dem att lösa issues relaterade till limits för filuppladdning. Denna enkla website-inställning kan ha oväntade effekter på din site.
Till exempel kan en låg limit för filuppladdningsstorlek ibland hindra you från att ladda upp filer med media uppladdaren eller installera större WordPress plugins och themes. Detta kan vara mycket frustrerande, särskilt när du inte är säker på hur du ändrar limiten.
I den här artikeln visar vi dig hur du enkelt kan öka den maximala storleken på filuppladdare i WordPress för att fixa dessa issues.
Varför öka den maximala storleken för filuppladdning i WordPress?
Din hosting provider för WordPress kommer att ange en standard för maximal storlek för upload av filer när du registrerar dig och installerar WordPress. Din hosting provider definierar denna limit, och den varierar vanligtvis från 2 MB till 500 MB.
För de flesta WordPress website ägare kommer denna limit att vara mer än tillräckligt.
Det finns dock tillfällen då du måste höja denna limit så att du inte runar in i upload errors.
Till exempel:
- You run a photography website and need to upload large images.
- Din portfölj med design eller fotografier har stora images.
- Du vill installera ett större WordPress theme eller plugin.
- You want to sell digital products like eBooks, photos, videos, and more.
- You update content regelbundet och add to ljud, foton och annat som ligger utanför den nuvarande limiten.
Med detta sagt, låt oss visa dig hur du kan öka den maximala storleken på filuppladdare på din WordPress site.
Note: Tänk på att om du displayed många stora filer på din website kan det allvarligt sakta ner dess hastighet och prestanda. Därför rekommenderar vi normalt att du aldrig uppladdar videoklipp till WordPress.
Eftersom de flesta användare har olika WordPress inställningar för webbhotell, kommer vi att täcka följande:
- How to Check Your Maximum File Upload Size Limit in WordPress
- Method 1: Contact Your WordPress Hosting Provider
- Method 2: Create or Edit an Existing php.ini file
- Method 3: Add Code to Your WordPress Theme functions.php File
- Method 4: Add Code to Your .htaccess File
- Method 5: Use a WordPress Plugin to Increase File Upload Size
Video Tutorial
Om du föredrar skriftliga instruktioner är det bara att fortsätta läsa.
Så här kontrollerar du din limit för maximal storlek på filuppladdning i WordPress
WordPress visar automatiskt limiten för maximal filuppladdningsstorlek när du laddar upp images eller andra media.
För att kontrollera detta, gå bara till Media ” Add New i din WordPress adminpanel, och du kommer att se den maximala filuppladdningsstorlekslimiten för din WordPress site.
Nu när du vet hur du hittar storlekslimiten ska vi visa dig hur du ökar den maximala storleken för upload i WordPress.
Metod 1: Kontakta din hosting provider för WordPress
Ett av de enklaste sätten att öka den maximala storleken för upload av filer i WordPress är att kontakta din WordPress hosting provider.
Detta är en relativt enkel uppgift för deras kundtjänst och kan göras på ett par minuter.
För Beginner kan detta vara mycket enklare än att lägga till kod i WordPress och editera server-filer.
Helt enkelt head över till din hosting providers website, gillar Bluehost, och logga in.
Klicka sedan på ikonen ”Chatt” längst ner på vyn. Du kan sedan be de anställda på supporten att öka storleken på filuppladdningen på din site i WordPress.
You can also reach out to support from inside your hosting account dashboard.
Metod 2: Skapa eller edit en befintlig php.ini-fil
Ett annat sätt att öka den maximala storleken på filuppladdningen är att skapa eller editera en fil som heter php.ini. Denna fil kontrollerar många settings för ditt WordPress webbhotell.
De flesta hosting providers för WordPress gillar Bluehost och har en nybörjarvänlig cPanel som hjälper dig att hantera din website.
Om din server har en cPanel dashboard kan du öka storleken på upload av filer med hjälp av de inbyggda tools.
Note: Följarna är från Bluehost cPanel. De flesta shared hosting providers kommer dock att ha liknande steg.
Du hittar en cPanel-knapp längst ner på tabben Webbhotell i Bluehost.
Om du klickar på den här knappen öppnas din cPanel dashboard.
Nu måste du rulla ner till Software section och klicka på ”MultiPHP INI Editor”.
Därefter rullar du ner till sektionen märkt ”upload_max_filesize” och enter en new maximal filstorlek i boxen.
Klicka sedan på knappen ”Tillämpa”.
Alternativt kan du clicka på menu tabs ”Editor Mode”, och då kan du ändra den maximala storleken för uppladdare direkt i editorn.
You need to edit the ’upload_max_filesize’ section to increase your file upload size.
När du är slutförd klickar du bara på knappen ”Save”.
Edit php.ini genom att lägga till kod
Om din nuvarande hosting provider inte erbjuder alternativet cPanel, måste du editera den här filen manuellt.
För att göra detta kan du använda en FTP-klient eller alternativet filhanterare i kontrollpanelen på ditt WordPress webbhotell.
Om du använder ett delat webbhotell kanske du ej ser php.ini-filen i din directory. Om du inte ser någon, skapar du helt enkelt en fil med namnet php.ini och uploadar den till din root folder.
Add sedan följande code snippet till filen:
upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300
Du kan ändra limiten ”256M” till den filstorlek som du behöver för din WordPress blogg.
Metod 3: Add Code to Your WordPress Theme functions.php File
Denna metod innebär att du lägger till kod i din functions.php-fil i ditt WordPress theme.
Istället för att editera filen direkt rekommenderar vi att du använder WPCode. Det är det bästa code snippets plugin som allow you to add code to your website without breaking it.
Om du inte har gjort det tidigare kan du läsa vår guide för nybörjare om hur du lägger till customize-kod i WordPress.
Först måste du installera det gratis pluginet WPCode. För mer detaljer, se vår Step-by-Step guide om hur du installerar ett WordPress plugin.
Vid aktivering ska du navigera till Code Snippets ” + Add Snippet. Du måste hovera musen över alternativet ”Add Your Custom Code” och sedan klicka på knappen ”Use snippet”.
På nästa vy måste du ge ditt nya snippet ett namn och ändra code type till ”PHP Snippet”.
Sedan kan du copy and paste följande code snippet under ”Code Preview”. Se till att du ändrar ’256M’ till den maximala filstorlek du behöver:
@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );
Till sist togglar du högst upp till ”Active” och klickar sedan på knappen ”Save Snippet”. Koden kommer nu att köras på din website.
Metod 4: Add Code till din .htaccess-fil
Ett annat sätt att öka den maximala filstorleken är att ändra .htaccess-filen. Denna fil kontrollerar konfigurationsinställningarna på hög nivå för din website.
För att göra detta måste du logga in på din website server via FTP. Om du inte har gjort det tidigare kan du läsa vår guide för nybörjare om hur man använder FTP för att uploada filer till WordPress.
Efter det måste du lokalisera din .htaccess-fil i din websites root folder.
Om du inte kan hitta din .htaccess-fil kan den vara dold av din filhanterare eller FTP-klient. För att lära dig mer, se vår guide om varför du inte kan hitta .htaccess-filen på din WordPress site.
Följer du detta måste du add to följande code snippet till din .htaccess fil:
php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 300
php_value max_input_time 300
Om du vill öka storleken på din maximala upload av filer ännu mer ändrar du bara ”64M” till den storlek som du behöver.
Metod 5: Använd ett tillägg till WordPress för att öka storleken på filuppladdningen
Ett annat sätt du kan öka limiten för maximal upload av filer är genom att använda WP Increase Upload Filesize plugin. Om du inte är bekväm med att lägga till kod i WordPress, kan detta vara ett bra alternativ för dig.
Det första du behöver göra är att installera och aktivera pluginet. För mer detaljer, se vår guide om hur du installerar ett plugin för WordPress.
Efter aktivering, navigera till Media ” Increase Upload Limit i din WordPress adminpanel.
Detta leder dig till en vy där du kan selecta en new storlek för upload i rullgardinsmenyn ”Choose Maximum Upload File Size”.
Klicka sedan på knappen ”Save Changes”.
Note: Den maximala storleken för upload av filer ställs in av din hosting provider. Om du behöver en filstorleksgräns som är större än den som anges i rullgardinsmenyn måste du kontakta din hosting provider och be att få öka limiten.
Vi hoppas att den här artikeln hjälpte dig att öka den maximala storleken på filuppladdare i WordPress. Du kanske också vill se vår guide om hur man väljer den bästa website-byggaren och våra expertval av de bästa apparna för virtuella företagstelefonnummer med gratis alternativ.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Dayo Olobayo
Thanks for showing how to check the default limit. Just checked mine now and saw it’s 1GB. I think that’s good enough for me so I won’t be touching anything. I must also add that the wpcode method would have been my preferred method if I needed to change anything.
Lisha Van Nieuwenhove
This help was BRILLIANT. THANK YOU!
WPBeginner Support
You’re welcome!
Administratör
Ray Konopka
Thanks for the tips. My site is hosted in BlueHost so I first tried Method 2. However, after changing the upload_max_filesize value, the Add New media page for my site still showed 64 MB. I went back into the MultiPHP INI Editor and looked at the other values. One other value stood out:
post_max_size
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.
After I increased the post_max_size value as well, then the Add New media upload page showed the new limit. Perhaps you can update the post to include this tip.
WPBeginner Support
Thank you for sharing this, we’ll be sure to look into it and possibly add it to the article in the future
Administratör
Mark
All my limits were increased as suggested, but I started getting ’files are too big’ after a plugin update. After double checking everything server and email side, the solution was changing from 5M to 5120kb in Contact Form 7 settings. The plugin suddenly stopped recognizing M when trying to override the default 1024kb setting.
WPBeginner Support
Thanks for sharing this should someone else run into this issue!
Administratör
devshah
Function.php method is not Working.
WPBeginner Support
It would depend on your host and what else is set up on your server for what will work. If nothing else works you can always reach out to your host for assistance.
Administratör
Halil AHMAD
The .htaccess worked for me. Thank you
Muzoora Barnabas
The .htaccess worked for me. Thank you
WPBeginner Support
Glad our recommendation was able to assist
Administratör
Muhammad Farooqi
You comments and thanks secion is almost 10 times longer..than the content of this page is guarantee of your amazing tips
WPBeginner Support
We’re happy we can help so many WordPress users
Administratör
Jacob Alas
The only method that worked for me was: htaccess Method
Thank you.
WPBeginner Support
Glad one of our methods was able to work for you
Administratör
Daniyar Nauryz
htaccess Method has worked for me.
WPBeginner Support
Glad our recommendation worked for you
Administratör
furqan
its not working.
WPBeginner Support
If the recommendations are not working for you, we would recommend reaching out to your hosting provider and they should be able to assist if this is something they’ve set on their end.
Administratör
Abdullah Ashraf
Thank you so much. I tried all the methods and the last method was helpful for me.
I would like to know should I undo the second last step that was php.ini?
WPBeginner Support
It is not required to remove that file but you can remove it if it is not working for your server.
Administratör
Bradley
None work.
WPBeginner Support
If none of our recommendations work, we would recommend reaching out to your hosting provider to see if it is a restriction that they have set on their servers.
Administratör
Ben
If you have access to the FTP, can I just upload the file in the wp-content/uploads/[year]/[month] folder?
WPBeginner Support
If you do that you would need a plugin to find the images, we have a guide on how to do that below:
https://www.wpbeginner.com/plugins/how-to-bulk-upload-wordpress-media-files-using-ftp/
Administratör
naved ahmed
Thanks a lot
.htaccess method worked for me.
You saved my lot of time.
Thanks again.
WPBeginner Support
Glad our guide was able to help you
Administratör
Adio Usman
Does this method works for restoring backup that is up to 3.5gb manually?
WPBeginner Support
It would depend on the method you are using but it could help with restoring a backup that large.
Administratör
viren
method 3 is perfectly worked for me.keep inspiring us.great work man.thnks
WPBeginner Support
Glad our recommendation was helpful
Administratör
ayman
.htaccess methode worked with me
WPBeginner Support
Glad our recommendation was helpful
Administratör
Sanchit Setia
Does this work on free hosting?
WPBeginner Support
You would want to check with your hosting provider if you are concerned
Administratör
bara
It works for me
WPBeginner Support
Glad our recommendation helped you
Administratör
abc
nothing is working for lms
WPBeginner Support
If none of the recommendations worked we would recommend reaching out to your hosting provider for assistance.
Administratör
Ahmad
I tried this but the size did not change… status is same please help what should I do know I am using localhost
WPBeginner Support
You would want to try restarting your localhost service just in case, otherwise, you would want to ensure you added/editied the php.ini correctly for the most common reason.
Administratör
Vittorio
I think
@ini_set( ’upload_max_size’ , ’64M’ );
should be
@ini_set( ’upload_max_filesize’ , ’64M’ );
WPBeginner Support
upload_max_size currently increases that value as well as a few other things which is why we don’t use upload_max_filesize
Administratör
MFoale
Thank you. The 3rd method worked for me. Very useful post and video.
WPBeginner Support
You’re welcome, glad we were able to help
Administratör
Masud Rana
Wow !its work. Thanks
WPBeginner Support
Glad our guide could help you
Administratör
Oliver
IT WORKS!!! THANKS
I made a file ini.php then uploaded it, then renamed it from ini.php.txt to ini.php and it worked.
thanks
WPBeginner Support
You’re welcome, glad our guide was able to help
Administratör
Brad
None of these works
WPBeginner Support
If our recommendations do not work you would want to reach out to your hosting provider to ensure they do not have it as part of their settings.
Administratör
Arivazhagan
Method 2 worked for me thanks a lot ive been struggling with this for two days …
WPBeginner Support
You’re welcome, glad our recommended solution was able to help you
Administratör
Sujan Chakraborty
you are great.I fix my problem by reading you post.Tnx
WPBeginner Support
Glad our article could be helpful
Administratör
Krakawid
Method 3 worked
WPBeginner Support
Glad our recommendation worked for you
Administratör
Tung
Method 1 worked wonders for me. Thanks a bunch!
WPBeginner Support
You’re welcome, glad our recommendation worked for you
Administratör
Trasadu
Thanks Method 3 really worked for me.
WPBeginner Support
Glad our recommendation was helpful
Administratör
Asad
How can i increase the upload limit while i have the wordpress hosting also functions.php isn’t updating
WPBeginner Support
If the file will not update, you would want to reach out to your hosting provider and they should be able to assist
Administratör
Chris
I want to increase the limit to 250mb but i dont know if this exposes my site to security treats, though am only using gravity form and I have also set to disable php execution on my upload folder. And have allowed only jpg, and mp3 files.
Please do you think this may affect my site load times as huge upload is coming from several users?
WPBeginner Support
If multiple users attempt uploads at the same time it can have an effect on your site’s load time but it shouldn’t open you to security threats
Administratör
Vinod
Thanks a lot!!! Method 3 worked for me
WPBeginner Support
Glad our recommendation worked for you
Administratör
Janice
Nice article, but I tried adding your 3 lines of code to the functions.php file, but got an ”unknown @ rule” error. What’s that all about?
WPBeginner Support
It would depend on the entire error but it could have been a hiccup with how the code was inserted, you may want to take a look at our guide here: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-pasting-snippets-from-the-web-into-wordpress/
Administratör
Abduaziz
Thanks a lot!!! Method 3 worked for me
WPBeginner Support
Glad our recommendation could help
Administratör
Alexander Gartley
Thanks, this helped me troubleshoot an upload limit. I’m on a Wordpress multisite network install, so it ended up being a setting in the Network Admin Settings.
I was confused at first, because my php settings were allowing larger uploads, but it was restricted in the Network Settings.
WPBeginner Support
Thanks for sharing what solved the problem for you
Administratör
Ernesto
Would have been great if you have included the .user.ini method.
.user.ini uploaded in the root folder with the same value/text in your edited php.ini
Most of the time, only this method works for shared hosting.
ErnestPH
WPBeginner Support
The php.ini file should work the same as the user.ini file unless your specific host ignores the php.ini but thank you for sharing your recommendation
Administratör
Mark
This is the only solution that works on my shared hosting server. Thanks Ernesto!
Tamir Davidoff
Not working for me.
I have followed this guide and double checked the php.ini file to make sure that the changed are in fact saved. changed htaccess file to increase limits. and also tried modifying the phpMyAdmin httpd-app.conf and php-settings.conf file. All of these files reflect max upload higher than 40m and my WP site does not reflect Any of these changes. Really frustrated here.
Please help me, thanks !
WPBeginner Support
If you haven’t already, you would want to reach out to your hosting provider to ensure there is not a setting on their end that is overriding what you are setting
Administratör
rajesh
i have tried all 3 method none of them worked. i am trying to upload newspaper theme in my in my wordpress site. but every time it show that php.ini file upload max file size.
plz help me
WPBeginner Support
You would want to reach out to your hosting provider to ensure they don’t have a setting that is overriding the changes you made.
Administratör
Adam Walsworth
Watchout for hidden php.ini files. In my setup I found 2 of them. The one which I found actually resolved the issue was found under
./etc/php/7.0/apache2/php.ini
modifying this file fixed my issue.
WPBeginner Support
Thanks for sharing your solution, with where that file is located we would recommend most users reach out to their hosting provider before looking in locations like that.
Administratör
Rafiq khan
Thanks buddy i have solved my problem by adopting method 2 by editing my php.ini file
Thanks alot you are working great
WPBeginner Support
Glad our article could help
Administratör
Carla
None of the above worked for me. A matter of fact, editing the htaccess file broke my site even after deleting the above code. Overwriting with a new file fixed the problem though.
I have a dedicated server on Bluehost. What worked for me was going in the WHM root, not cpanel nor FTP access. Search for MultiPHP INI Editor. Give it at least 5 minutes to load if you only see the title and icon. You can set you upload time, post size, etc. there. Works instantly, even if your site is using Cloudflare, without placing it in development mode or clearing the cache. I hope this helps someone.
WPBeginner Support
Thank you for sharing what worked for you, should other users be on a dedicated server, if they reach out and let BlueHost know the need to increase the upload size then BlueHost can normally edit that for them
Administratör
Pezza
Great Stuff! .htaccess worked for me!
WPBeginner Support
Thank you, glad our guide could help
Administratör
ReineR
htaccess metod worked for me, thanks!
WPBeginner Support
Glad our article could help
Administratör
Ahmed
Work for me
3. htaccess Method
you need to click (show hidden files to view and edit this file).
WPBeginner Support
Glad our article could help
Administratör
rahul
when i tried this
Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.
this happened to me
whats the solution of this
WPBeginner Support
You would need to use FTP rather than WordPress itself to add the code: https://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/
Administratör
Ephraim
I had been trying php.ini method but it never works please how will I set it..
Or you should please tell me the were to paste at function.php
WPBeginner Support
You would normally use a text editor to set the content in the php.ini file. For your functions.php it should go at the end normally so it can be removed later as needed. You may also want to check with your hosting provider if you are having trouble with these methods for if they can assist in increasing the file size for you.
Administratör
Ivos G.
None worked for me. But this one fixed it – add to your .htaccess this line:
LimitRequestBody 104857600
WPBeginner Support
Thanks for sharing your solution for this issue
Administratör