# Upload files Using the REST API to upload a file to WordPress is quite simple. All you need is to send the file in a `POST`-Request to the `wp/v2/media` route. There are two ways of sending a file. The first method simply sends the file in the body of the request. The following PHP script shows the basic principle: ``` esc_url_raw( rest_url( '/wp/v2/media/' ) ), 'nonce' => wp_create_nonce( 'wp_rest' ), ]; wp_localize_script( 'rest-uploader', 'RestVars', $js_vars ); } ); add_shortcode( 'uploader', function() { wp_enqueue_script( 'rest-uploader' ); ob_start(); ?>