POSTing file to /media endpoint
-
I’m trying to upload an image using the /media end point.
I thought this would work$.ajax({ url: 'http://<my-domain>/wp-json/wp/v2/media/', headers: { 'X-WP-Nonce' : '<nonce-goes-here>', 'Content-Type': 'undefined', 'Content-Disposition': 'attachment;filename=<filename>' }, type: 'POST', data: <file data>, cache: false, contentType: false, processData: false, });
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘POSTing file to /media endpoint’ is closed to new replies.