Title: Uploading files using php move_uploaded_file() function
Last modified: June 20, 2020

---

# Uploading files using php move_uploaded_file() function

 *  Resolved [killian1726](https://wordpress.org/support/users/killian1726/)
 * (@killian1726)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/uploading-files-using-php-move_uploaded_file-function/)
 * Hello, I am currently building a WordPress website, and I’ve been coding a php
   script that is supposed to handle the upload of pdf files to the server.
 * The point of this program is for the user to be able select a pdf file from his
   computer, and when he uploads it, the files has to be moved to the directory /
   wp-content/upload/factures/file.pdf, which I already created manually.
 * I’ve already done this type of php program on other projects (but not using WordPress),
   and each time I was using the php function “move_uploaded_file()”.
    But with 
   WordPress, I can’t manage to find a solution to move the file to the directory,
   although I am sure I am using the right path, it tells me that the directory 
   doesn’t exist.
 * Does anybody know if there is a more simple method to automaticly upload files
   to a wordpress website without using a plugin? Is there any wordpress function
   that can do the job other than move_uploaded_file()?
 * I hope my question is clear, and thank you in advance, any piece of information
   would be much appreciated !
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fuploading-files-using-php-move_uploaded_file-function%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Prashant Singh](https://wordpress.org/support/users/prashantvatsh/)
 * (@prashantvatsh)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/uploading-files-using-php-move_uploaded_file-function/#post-13010197)
 * Hi
 * Please check this [link](https://wordpress.stackexchange.com/questions/125871/correct-syntax-for-uploading-files-to-custom-directory-in-wordpress).
 * If you don’t want to insert the file information in the database then you can
   remove the insert statement.
 * I hope this will help you.
 * Kind Regards
 *  Thread Starter [killian1726](https://wordpress.org/support/users/killian1726/)
 * (@killian1726)
 * [5 years, 9 months ago](https://wordpress.org/support/topic/uploading-files-using-php-move_uploaded_file-function/#post-13015614)
 * Hi,
 * Thank you very much it helped me a lot !
 * Have a great day !

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

The topic ‘Uploading files using php move_uploaded_file() function’ is closed to
new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [killian1726](https://wordpress.org/support/users/killian1726/)
 * Last activity: [5 years, 9 months ago](https://wordpress.org/support/topic/uploading-files-using-php-move_uploaded_file-function/#post-13015614)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
