Ask your WordPress questions! Pay money and get answers fast! (more info)

Programmatically upload an image to the media gallery WordPress

  • SOLVED

Hi all,

I want a custom page template that allows logged in users to add an image to the media gallery. I want the thumbnails to be created automatically. I don't want the user to have to go through the admin interface to do this, hence using a page template. The front end should consist only of a file upload field and an Upload button.

Thanks
Sean

Answers (2)

2013-02-09

Francisco Javier Carazo Gil answers:

Have you tried this? http://wordpress.stackexchange.com/questions/11920/submit-post-and-upload-image-from-front-end


Francisco Javier Carazo Gil comments:

Maybe this is better for your requirement: http://www.clickonf5.org/6034/allow-add-images-gallery-frontend-wordpress-blog/


Sean H comments:

wow, thank you for this Francisco. I think this what I wanted. testing now. how did you find it? I have been searching for days for this. all of my efforts pointed to this page: http://codex.wordpress.org/Function_Reference/wp_insert_attachment - I copied the code, modified it and it didn't work.


Francisco Javier Carazo Gil comments:

Many days searching for WordPress fixes and patches :)

wp_insert_attachment should also work, try with WP_DEBUG to true, let's see whether there is something more.

2013-02-09

Kyle answers:

Do you have gravity forms?