Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här ökar du den maximala storleken för filuppladdning i WordPress

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.

How to increase the maximum file upload size in WordPress

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:

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:

Video Tutorial

Subscribe to WPBeginner

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.

Check current file upload size limit

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.

Clicking the Bluehost live chat support button in the dashboard

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.

Open cPanel in 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”.

MuliPHP INI Editor in Bluehost's cPanel

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”.

Upload Max Filesize Setting

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”.

Change max upload filesize in code editor

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”.

Add a Custom Snippet in WPCode

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' );
Save Your Custom Snippet in WPCode

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.

Open .htaccess file

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”.

Increase file upload size with plugin

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.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

407 kommentarerLämna ett svar

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Abduaziz

    Thanks a lot!!! Method 3 worked for me

    • WPBeginner Support

      Glad our recommendation could help :)

      Administratör

  3. 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

  4. 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!

  5. 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

  6. 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

  7. 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

  8. 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

  9. 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

  10. Pezza

    Great Stuff! .htaccess worked for me!

    • WPBeginner Support

      Thank you, glad our guide could help :)

      Administratör

  11. ReineR

    htaccess metod worked for me, thanks!

    • WPBeginner Support

      Glad our article could help :)

      Administratör

  12. 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

  13. 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

  14. 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

  15. 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

  16. Achilleas

    I am using Nginx and i had already setup properly the values for php in the php.ini but what fixed it was puting the same value in the server block with the variable client_max_body_size xxxM;

    I am writing this hoping it will help someone.

  17. RAHUL

    That worked for me thanx

    • WPBeginner Support

      Glad our tutorial could help :)

      Administratör

  18. Adriana Sabo

    None of the options worked for me. Nothing happened when I tried the first two, and the last one prompted an error 500. Any way you can help?

  19. Carl

    Very helpful, thank you!

  20. Md. Rana

    The third option is worked for me. :)

    • WPBeginner Support

      Hey Rana,

      Glad it worked out for you. Don’t forget to follow us on Facebook for more WordPress tips and tutorials.

      Administratör

  21. Tom Allen

    The above explanation is fine for hosted sites, bit what about us guys that locahost? I still can figure out the ”upload_max_filesize” error when downloading Updfaftplus from WP Plugins or from a download zip file. I am a beginner and need hand-holding through this process. Help is appreciated.

  22. crystal

    hta access worked.
    you guys must put the code before #END Wordpress
    if you put after #end wordpress then site goes to 500 internal server error in my experience with godaddy hosting

    • Luis Felipe Lino

      Thanks.

  23. Jaime Lopes

    On most of the shared cPanel sites I’ve setup:

    -changing .htaccess brings the whole site down (500 internal error)
    -adding php.ini or php5.ini files does nothing
    -there is no option to choose ’Site Software’ in cPanel…

  24. Joseph

    Thanks so much. The .htaccess file worked for me

  25. John S

    Thanks so much. The .htaccess file worked for me!

  26. Karina

    Thanks you so much!!! The .htaccess version worked for me :D

  27. Megan

    Thank you! This was a huge help! I couldn’t even upload plugins because my limit was pre-set at 2MB…Now I’ve got it to 64MB and am able to work.
    Thanks!

  28. Okimi Solomon

    Thanks a lot. The second option worked for me. God bless you

  29. Benj

    Modifying .htaccess file worked for me. Thanks a lot..

  30. Martin Croker

    On vidahost (now TSOhost).

    Adding the following php.ini worked for me… however (and I’m still a bit confused why), just putting it at http root didn’t work – I had to duplicate the php.ini file inside wp-admin and wp-include directories within wordpress.

  31. Kabelo

    Very helpful. Thanks very much.

  32. Dwayne S

    I’m on HostGator and currently having issue with max execution time. It occurred a few weeks ago and HostGator support fixed the issue. It now reappeared and support is telling me that they can’t fix it because I’m on shared server. The agent even crashed my site by manually editing the htaccess file and didn’t verify if it was working or not. He did however recommend a plugin that would edit the htaccess file with code to increase the limit but it doesn’t work. I guess HostGator blocks it

  33. Jessany

    I added the code into the .php functions folder, and now Wordpress will not load. How do I fix this problem??

    • WPBeginner Support

      Hi Jessany,

      You can delete the code you added by accessing your website via FTP or File Manager in cPanel.

      Administratör

    • bala

      upload the above given code to .htaccess file it is working

  34. Caleb

    I have GoDaddy hosting and contacted them to help me increase my file upload size. It was a piece of cake — I didn’t have to create any files, add code to my theme, or anything like that. So for those of you who have GoDaddy or cPanel type controls, forget hacks and just use your admin settings.

    Here’s what support had me do:
    1. Go to your cPanel Admin (a similar hosting panel ’might’ work somewhat the same)
    2. Scroll down to the ’Software’ and click on ’Select PHP Version’
    3. Click on ’Switch to PHP Options’ in the top right And TADA! There’s all your PHP Options!
    4. Just go down and change the ’post_max_filesize’ and ’upload_max_filesize’ to whatever you want, apply and save your changes, and you’re now a safe and happy non-coding website owner.

    Good luck!

    • ZafB

      Thanks that worked perfect

    • Alissa

      Thank you for posting this! It worked great!

    • Alejandra

      Thanks a lot! That worked indeed!!

    • Paul Palmer

      Brilliant solution – worked perfectly and easily! Many thanks.

    • Rich Perozich

      This worked for me but in order to even find these files, I had to call godaddy where I was walked through these steps or I never would have been able to navigate to the cpanel Admin without their help.
      1. Sign on to godaddy
      2. Click on my products upper left
      3. Under web hosting click manage all
      4. Click web hosting with C panel
      5. Click C panel Admin icon
      6. Scroll down to Software and click Select php version
      7. Click on switch to php options
      8. At bottom of page click on the number upload_max_filesize and select # you wish as the max filesize
      9. Click apply. It works. Now file sizes can be uploaded to the selected max.

  35. Chris Sandford

    Multisite Users:
    If your a dumb dumb like me, you may have tried everything to no avail.
    Don’t forget if you’re using Wordpress Multi-site, to change the upload settings for individual sites.
    Network Admin > Settings > Max upload file size

    You may still need to use the tips in this article, but without changing the upload settings for multi-site, you won’t know if it’s working.

    • Stef Thoen

      You’re my hero. I’ve been researching this issue for way to long until I finally saw your post. Thanks so much.

    • Ron

      Thank you for this! This should be in the body of this article!

    • Hitesh L.

      WORKED! kudos to you!!!!!!!

  36. Emanuel Pietri

    Method 3 – with .htaccess – works fine for me with theme

  37. Stefanos Kargas

    Thanks!! I changed .htaccess file and it worked.

  38. haadi

    hi. thanks a lot. the 3rd one worked for me

  39. Jim R

    Option 2 worked good. Thanks for the info.

  40. Tor Helge

    It worked when I did the last one with .htaccess

  41. mara

    Anyone on here get this to work with Godaddy? There are very unhelpful. I know I need to create the php.ini file, (and I did), but none of the solutions you posted worked. Any help is appreciated.

  42. WangTuanJie

    after 3 method, i couldn’t see success.

  43. Mahadi

    Thanks man!! .htacces worked for me!

  44. Lynn

    Wish you wouldn’t assume everyone looking for this solution knows what you mean by our ”Theme Functions File” – do you mean functions.php? I’m not an expert, and I’m really good at following precise directions, and don’t want to even put a toe in the water of editing files if I don’t know EXACTLY what file you’re talking about! No clues were provided, like what other code I might look for in the file to know I’m in the right place, etc. So…this didn’t help me at all :-(

      • Justin

        Yea, but where does it go in the functions.php. At the top, bottom, in the middle? Inside the ””

  45. jack

    thank you all those steps helped me

  46. Alex

    Thank you, method 3 really worked for me
    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

    • vikram

      HI

      Do you use shared hosting

  47. shahrin

    great! htaccess method work for me. I’m so relieve,guys! Thanks in advance

  48. Samba Siva

    .htaccess method worked for me :)

  49. nelson

    htaccess worked for me ,thank you

  50. Sagar

    php.ini is worked for me.
    cheers.
    thnks man !!

  51. Mituka

    This worked for me.

    Open your .htacess file with notepad.

    Skip everything you see and at the bottom.

    Paste the following and save.

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

    • Thomas

      Where exactly did you paste it?

      # BEGIN WordPress

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]

      # END WordPress

      php_value upload_max_filesize 64M
      php_value post_max_size 64M
      php_value max_execution_time 300
      php_value max_input_time 300

      Is it before the #END WordPress statement? ( I get error when I do that)

      Or should it be after the #END WordPress statement?

      • WPBeginner Support

        Hi Thomas,

        You need to paste it at the end of your .htaccess file after the #END WordPress line.

        Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.