I create a form for user to submit content from the frontend. The only problem is I don’t know how to handler the image upload.
So, I want to know how to use the WP media uploader in the frontend. The media uploader should be appeared like in the ‘wp-admin/media-new.php’.
I don’t want the pop up version of the uploader, as it seen in post/page page. Because it has other feature that I don’t want user to use, such as ‘Media Library’, ‘Create gallery’, ‘Set Featured Image’ etc.
Is there any tutorial or documentation on how to do it?
Thanks
Add this code to your theme’s functions.php file:
This will cause the the media upload files to load on your front end pages. If you would like to load them only on one specific page where they will be needed, you can wrap
wp_enqueue_media()
in anis_page()
statement to check to see if the page being displayed is the specific page you need.After that, you can follow the instructions in this tutorial: http://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/
the Ajax calls for /wp-admin/media-upload.php so there is good position to start.
it calls the action: “media_upload_$type”, for exemple media_upload_image from /wp-admin/includes/media.php#L2512
that is connected to the function wp_media_upload_handler()
You can dig deeper from there. ( I need som sleep now 🙂 )
Here is the results from a Google search I did and here is a plugin that will allow you to upload from the frontend of your site Frontend Uploader
That should get you started in a good direction as far as tutorials that be available.
Good luck