I would like to implement an public image upload in my Wordpress Theme with ajax. What's the secure way to do this?

I have read many about security problems when allow users to upload files to the server.

And is it possible to prevent malicious images?

closed as too broad by Howdy_McGee, fuxia Apr 30 '16 at 0:14

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • what exactly does this question has to do with wordpress? If you need security advice you better ask it in a security forum.... – Mark Kaplun Apr 17 '16 at 18:45
  • It may be better to phrase this as how to implement an AJAX file uploader in WordPress, while also specifying some constraints. It's a broad question ( almost too broad ) but still on topic. Perhaps it could be broken down into 2 parts, how to implement an AJAX file upload from the frontend, and how to secure that uploader to only work with images? That would make for 2 questions – Tom J Nowell Apr 17 '16 at 19:04
  • @MarkKaplun Thank you for your fast reply. I'm not shure if its wordpress-specific. Wordpress have different handlers for ajax-upload and maybe some scurity features for file upload? – Dennis Apr 17 '16 at 19:21
  • @TomJNowell Thank you too for your fast reply. I'm interesting in both questions with focus on the second questions. But I am grateful if someone have a answer of one of both questions. – Dennis Apr 17 '16 at 19:21
  • There are many security features in wordpress, but first you need to decide what kind of security you want to have – Mark Kaplun Apr 17 '16 at 19:39