Title: Upload file by code WordPress
Last modified: August 19, 2016

---

# Upload file by code WordPress

 *  Resolved [lucaswxp](https://wordpress.org/support/users/lucaswxp/)
 * (@lucaswxp)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/upload-file-by-code-wordpress/)
 * Hello everyone.
    I need upload a file by code, but I don’t know how (by default
   wordpress functions).
 * I need the same behavior when user upload by the library file manager (with the
   generation of thumbnails – added between add_image_size() and etc)
 * I already know how to insert a attachment to the db, but not upload the file.
 * Thanx o/

Viewing 1 replies (of 1 total)

 *  Thread Starter [lucaswxp](https://wordpress.org/support/users/lucaswxp/)
 * (@lucaswxp)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/upload-file-by-code-wordpress/#post-1584341)
 * Forget.
    I found it =) media_handle_upload()

Viewing 1 replies (of 1 total)

The topic ‘Upload file by code WordPress’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [lucaswxp](https://wordpress.org/support/users/lucaswxp/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/upload-file-by-code-wordpress/#post-1584341)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
