Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Within a plugin I am generating an image, I would like to save this image to the upload folder and update the WPDB with the location of said file. I cant find any build in wordpress functions to handle saving/writing/adding a file to the upload folder, should I just do this the old fashioned way with php, or is there something built into WordPress that I'm missing?

share|improve this question
Have a look at media_handle_upload –  kraftner Mar 21 '14 at 13:15

2 Answers 2

Check into the functions: wp_handle_upload() and media_handle_upload()

share|improve this answer

You need only to save generated file in the upload folder!... Use php.

If you need to add this file in Media libary than use wp_insert_attachment()

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.