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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 was marked as an exact duplicate of an existing question.

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

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.