Nyligen frågade en av våra användare oss hur de kan ladda upp stora bilder i WordPress. Även om detta var ett vanligt problem för flera år sedan, erbjuder de flesta moderna WordPress-värdleverantörer nu generösa uppladdningsgränser (ofta 64 MB till 512 MB) som rymmer de flesta bildstorlekar.
Faktum är att om du stöter på uppladdningsgränser idag är det värt att fundera på om du verkligen behöver så stora filer. De flesta högkvalitativa webbbilder är långt under 5 MB, och korrekt optimering kan minska dem ytterligare utan att förlora synlig kvalitet.
Men om du behöver ladda upp exceptionellt stora filer (som högupplösta fotografier eller designfiler) visar vi dig hur du justerar dessa gränser. Tänk bara på att mycket stora bilder kan göra din webbplats långsammare och påverka användarupplevelsen.

Förstå gränserna för bilduppladdning i WordPress
Om du ser ett felmeddelande som säger “filnamn.jpg överskrider den maximala uppladdningsstorleken för den här webbplatsen”, kanske du blir förvånad över att höra att detta inte brukar vara en begränsning längre.
Faktum är att Bluehosts delade hosting plan som vi använder för att testa WordPress-handledning har en uppladdningsgräns på 512 MB, och det är inte deras dyraste plan. De flesta andra WordPress-värdtjänstleverantörer sätter idag liknande generösa gränser, vanligtvis mellan 64 MB och 512 MB.
För att sätta det här i perspektiv kan du se hur typiska optimerade webbbilder ser ut:
- Bilder för blogginlägg: Vanligtvis 1-2 MB
- Produktfoton: 2-3MB
- Bilder på rubriker: 2-4 MB
- Fotoportfölj: 3-5 MB
Men om du fortfarande har problem med uppladdningen kan du kontrollera din nuvarande gräns genom att besöka Media ” Lägg till ny sida. Dessa begränsningar kan bero på värdleverantörens inställningar, begränsningar av minnesgränser eller serverkonfigurationsinställningar.

Om du stöter på något av dessa error, kommer den här artikeln att hjälpa dig att fixa det så att du enkelt kan uppladare stora filer till WordPress.
🚨 Vänta! Innan du går vidare till resten av handledningen rekommenderar vi starkt att du använder ett bildoptimeringsverktyg först för att minska filstorlekarna utan att förlora kvalitet. Detta kommer att hjälpa din webbplats att ladda snabbare och rankas bättre i sökmotorer.
Se vår guide om hur du optimerar bilder för webbprestanda för steg-för-steg-instruktioner.
Så här ökar du den maximala uppladdningsstorleken för bilder i WordPress
Om du vill ladda upp stora bilder och mediefiler i WordPress, så här fixar du problemet med bilduppladdningens storlek i WordPress.
Den här metoden kräver att du lägger till kod i WordPress. Om du inte har gjort det tidigare, oroa dig inte, för vi kommer att använda ett gratis kodsnuttsplugin som heter WPCode för att göra detta på ett säkert sätt.

För att komma igång måste du installera och aktivera det gratis pluginet WPCode. För instruktioner, se denna tutorial om hur du installerar ett plugin för WordPress.
När pluginet är aktiverat går du till Code Snippets ” + Add Snippet page från din WordPress dashpanel.
Därefter klickar du på knappen “+ Add Custom Snippet” under alternativet “Add Your Custom Code (New Snippet)”.

Lägg sedan till en titel för din kod och klistra in kodsnutten nedan i rutan “Code Preview”:
1 2 3 | @ ini_set ( 'upload_max_size' , '256M' ); @ ini_set ( 'post_max_size' , '256M' ); @ ini_set ( 'max_execution_time' , '300' ); |
Se till att ersätta “256M” med önskad maximal filstorlek.
Glöm inte att välja “PHP Snippet” som kodtyp från rullgardinsmenyn på höger sida av skärmen.

Slutligen är det bara att växla från “Inactive” till “Active”.
Klicka sedan på knappen “Save Snippet”.

Den här koden försöker öka gränserna för maximal filstorlek för uppladdning, maximal storlek för inlägg och maximal exekveringstid för din WordPress-webbplats.
Det är dock inte säkert att den här metoden fungerar för alla webbplatser. I så fall kan du ta en titt på vår guide om hur du ökar den maximala filuppladdningsstorleken i WordPress för mer information.
Behöver du verkligen uppladda stora image-filer i WordPress?
Låt oss sätta bildstorlekar i perspektiv. De flesta optimerade webbbilder är under 5 MB, även för fotografier av hög kvalitet.
Även om du är en professionell fotograf som vill visa upp ditt arbete ska du komma ihåg att webbbesökare inte behöver samma upplösning som tryckta medier. En korrekt optimerad bild på 3 MB kan se lika fantastisk ut på skärmen som en bild på 15 MB, samtidigt som den laddas mycket snabbare.
Stora bildfiler påverkar din webbplats på flera sätt:
- Långsammare laddningstider för sidor
- Högre lagringsanvändning för hosting
- Sämre rankning i sökmotorer
- Dålig användarupplevelse på mobila enheter
Här är vad vi rekommenderar istället:
- Optimera dina bilder innan du laddar upp dem som vi rekommenderade.
- Använd ett galleriplugin som Envira Gallery för webbplatser med fotografier. Det hanterar automatiskt bildoptimering och skapar responsiva gallerier som laddas snabbt på alla enheter.
- Överväg att använda ett CDN (Content Delivery Network) om du har ett stort bildbibliotek. CDN:er serverar dina bilder från servrar över hela världen, vilket förbättrar laddningstiderna och användarupplevelsen. Se vår guide om hur du installerar och konfigurerar WordPress CDN-lösning för detaljerade instruktioner.
Det var allt, vi hoppas att den här guiden hjälpte dig att lära dig hur du laddar upp stora bilder i WordPress. Du kanske också vill se vår guide om effektiva WordPress-designelement och våra val av de bästa dra-och-släpp-sidbyggarna för WordPress.
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.
edizzz
How do I put a button to download the image of the post like the wallpapers sites?
Tyler Simonds
Re-sizing images prior to upload is a pain–a whole ‘nother step that WordPress should do automatically.
Brittney
Hello,
I tried using this code the 1st code into the functions folder, and now my website no longer works. I am getting “Parse error: syntax error, unexpected ‘@’ in ___” even after I have deleted the code and tried to update it back to normal. Any suggestions?
Wali shah afridi
i upload the above code but still the large image file does not upload in my block , kindly tell my that what i do know ??
Chase
I would like to clarify that making changes to functions.php files has no effect and that editing my .htaccess file causes an internal server error no matter how perfect I try to make the code. Should I be uploading large video files using another method? The main reason I want to upload the video is to share with a small group of people. I can’t upload it with YouTube, and therefore can embed into WordPress via YouTube because they claim a copyright on my music and the audio is automatically hushed. I need that specific audio track with my video, so YouTube is not an option. So I guess if I can’t solve this problem I need to either find a video hosting service that does not flag copyrighted material or try to host it myself, both of which are a bit off topic for this message board. I am assuming in am out of luck at this point.
Chase
Nothing works to upload large files on my GoDaddy WordPress multi-site account running the new version of php. I certainly can’t add directly though my WordPress media browser, so I upload the recommended way via FTP first. The problem is I can’t get the files from my ftp folder to the WordPress media browser. Very little relevant information is posted about the topic online. The recommended “Add from server” plugin does not work. The backup version does not work. The developer does not know. I have all my settings at the right levels in the cPanel configuration settings. I verified with GoDaddy three times. GoDaddy said I can’t do anything more on the hosting end and that it should work. Since the actual php.ini file is not accessible in GoDaddy, creating a new php5.ini or regular php.ini is recommended for GoDaddy servers, but this does not work for me. I can’t edit my actual php.ini file as the video shows. My files size a 150MB mp4 video file and can’t get it much smaller. I adjusted all of the WordPress settings for uploading large files and video files. This did not work. Does anybody know what to do? In the meantime, I am trying to find an another plugin that actually works.
WPBeginner Support
You can simply paste the link of the uploaded file into your WordPress post editor and it will embed it for you. For example if you uploaded the file /wp-content/uploads/my-video.mp4 then you can just add http://example.com/wp-content/uploads/my-video.mp4 in a blog post (replace example.com with your own domain name) and WordPress will embed it for you. Give it a try let us know how it goes.
Admin
Lutaaya paddy
thank you for this article it has worked for me . the code which is put in the .htaccess
Penelope
The reason I would like my max upload size increased is because I have a button that opens a URL link of my catalog for customers to download. This link is from my media folder in wordpress.
If I use a link in a button, does this slow down my website? Do you have a recommendation on how to go about allowing viewers to view a pdf catalog without slowing down a website?
Ankit Agarwal
Though for photographers, using a template ( or theme ) that does not allows large image sizes is not understandable. And for rest of us using a plugin seems logical since we will never want to upload a 10 MB+ ( even that’s too high) for the fear of reducing speed. Other wise can there be another reason of uploading high res images?
gary odom
You call this WP for beginners but when you proceed to talk about things like php file and ftp client you assume a beginner knows of what you speak. I am sure there many that do, but do real beginners really know what you are talking about? Of course, you are entitled to do what you wish, but it certainly does not cater to true beginners that are still finding they way around the WP program. Many of us had our hosting service install WordPress for us so we are not acquainted with much of what you speak. i am anxious to learn but first I must understand the basics.
WPBeginner Support
Thanks for the feedback. We do miss things occasionally, but you can always ask us to clarify in the comments. We will be happy to offer further explanation.
PHP is the programming language in which WordPress is written. FTP client is a software that allows you to connect to your web server to edit and upload files on your shared hosting server. Take a look at our guide on how to use FTP to upload files to WordPress for beginners.
Admin
Rybird
Very well written informative article.