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

Comment restreindre les téléversements à des types de fichiers spécifiés uniquement dans WordPress

Il y a quelques jours, alors que nous travaillions sur le site d’un client, on nous a demandé de coder une fonction qui limite les téléversements uniquement aux types de fichiers spécifiés (jpg, gif, png). Après avoir cherché dans le Dépôt et n’avoir rien trouvé qui puisse faire cela, nous avons décidé de créer notre propre extension. Hier, il a été approuvé dans le dépôt d’extension de WordPress et il s’appelle Restrict Téléversement.

Contrairement à d’autres extensions, cette extension n’a pas de panneau de réglages super complexe. En fait, il n’a pas de panneau de réglages du tout. Il est Version pour faire une chose et une chose uniquement. Il empêche vos éditeurs/éditrices de téléverser tout autre type de fichier que les images (jpg, gif, png). Les extensions de ce type sont idéales car elles fonctionnent silencieusement en arrière-plan et n’ont aucun impact sur le temps de chargement de votre site ou sur votre activité quotidienne.

Tout ce que vous avez à faire est simplement d’installer et d’activer l’extension. Téléchargez Restrict Téléversé maintenant.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial 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.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

8 commentairesLeave a Reply

  1. Yulian

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

  2. wpbeginner

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

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

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

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

  6. Debajyoti

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

  7. wpbeginner

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

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

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.