Title: Plugin &#8211; File Upload &#8211; Paths Help
Last modified: August 19, 2016

---

# Plugin – File Upload – Paths Help

 *  [Ryann](https://wordpress.org/support/users/ryann/)
 * (@ryann)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/plugin-file-upload-paths-help/)
 * I’m trying to write a custom plug-in so that the user can maintain a specific
   image on their site. I’m trying to add a function to upload the file to a specific
   directory to which I’ve granted 777 permissions (or the IIS equivalent).
 * e.g. wp-content/plugins/cp_myplugin/images
 * I’m attempting to use the method described here: [http://www.w3schools.com/php/php_file_upload.asp](http://www.w3schools.com/php/php_file_upload.asp).
 * Using straight php – with this example I can place a form and an upload script
   in the wp-content/plugins/cp_myplugin/ directory and it uploads the file to the
   images directory as expected.
 * However when I add this code into my plugin function – it generates two errors:
 * move_uploaded_file(images/test.txt) [function.move-uploaded-file]: failed to 
   open stream: Permission denied
 * Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘
   C:\Windows\Temp\php9E4A.tmp’ to ‘images/test.txt’
 * I know that the folder has the correct permissions because of my previous successful
   tests – so I’m thinking it may be because the path although relative to the plug-
   in file, not relative to where the script is being executed when its pulled into
   wp-admin/admin.php?
 * Any help on the best way to set up my upload path for a plug-in would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [schmeal](https://wordpress.org/support/users/schmeal/)
 * (@schmeal)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/plugin-file-upload-paths-help/#post-1556416)
 * Any luck finding a solution for this? I was looking myself for one
 *  [DRihal](https://wordpress.org/support/users/drihal/)
 * (@drihal)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-file-upload-paths-help/#post-1556427)
 * I’m having problems with this too.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Plugin – File Upload – Paths Help’ is closed to new replies.

## Tags

 * [file](https://wordpress.org/support/topic-tag/file/)
 * [path](https://wordpress.org/support/topic-tag/path/)
 * [upload](https://wordpress.org/support/topic-tag/upload/)

 * 2 replies
 * 3 participants
 * Last reply from: [DRihal](https://wordpress.org/support/users/drihal/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/plugin-file-upload-paths-help/#post-1556427)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
