Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Possible Duplicate:
How can you upload an image from within a settings page?

I am developing a plugin. Which has a form.

The form contains the following fields.

  1. Course Name
  2. Course file.

The course file field is of type file from where I will upload a file. The name of the file I will store in database and the the uploaded file should save in the wp-content/uploads directory.

How will I do this in wordpress. I am new to plugin development so please help me out.

share|improve this question

marked as duplicate by Chip Bennett, toscho Jul 15 '12 at 23:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Please search the site for related questions before posting. –  Chip Bennett Feb 9 '12 at 15:57

1 Answer 1

Have you looked at wp_upload_bits, it will create th file in the upload folder.

Example :

 $upload = wp_upload_bits( $_FILES["course_file"]["name"], null, file_get_contents( $_FILES["course_file"]["tmp_name"] ) );
share|improve this answer

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