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 begränsar du uppladdningar till endast angivna filtyper i WordPress

För några dagar sedan när vi arbetade på en kunds webbplats, blev vi ombedda att koda en funktion som begränsar uppladdare till endast angivna filtyper (jpg, gif, png). Efter att ha tittat runt i repository och inte hittat något som kan göra detta bestämde vi oss för att skapa ett eget plugin. Igår blev det approved i WordPress plugin repository och det anropas Restrict Uploads.

Till skillnad från andra tillägg har detta plugin INTE en superkomplex panel för inställningar. Faktum är att det inte har någon panel för inställningar kl. Det är byggt för att göra en sak och en sak bara. Det är att hindra dina editors från att uppladare någon annan filtyp notis från images (jpg, gif, png). Tillägg som dessa är den perfekta typen eftersom det fungerar tyst i bakgrunden och inte har någon inverkan på din webbplats laddningstid eller din dagliga aktivitet.

Allt du behöver göra är att helt enkelt installera och aktivera pluginet. Download Restrict Uploads nu.

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

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

    Really nice plugin!! Save me time!! Thanks!

  3. wpbeginner

    @susan suarez Yes you are correct. This will prevent any malicious entry using the wp-admin to upload stuff using the media uploader…

  4. truecalorie

    Very handy – thanks for adding this. Would this also help with the security of the plugin? So that if a hacker got in, they couldn’t upload any other type media file?

  5. Debajyoti

    @wpbeginner You’re right…. I wanted to focus on .JPG, .PNG and .GIF in capital… coz they can’t be uploaded. Some image editors save in capitals…

  6. wpbeginner

    @Debajyoti Then there would be no point of having this plugin. The whole idea is to keep the editors from uploading any other file type aside from images. We will work on an improvement for this plugin that will let you pick which users to limit the stuff for though :)

  7. Debajyoti

    You might also add .zip and .txt and .JPG, .PNG, .GIF to the filter.

  8. wpbeginner

    @JasonDittmer Yea I love plugin like these myself. Because they don’t require you to do anything. It is for one thing only.

  9. JasonDittmer

    I was expecting to read about how I had to write a bunch of code to make this work. Thanks for the simple plugin. Nice quick fix!

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.