[wp-trac] [WordPress Trac] #41774: REST-API: Media endpoint (POST): Unable to upload files
WordPress Trac
noreply at wordpress.org
Tue Sep 5 06:53:03 UTC 2017
#41774: REST-API: Media endpoint (POST): Unable to upload files
--------------------------+------------------------------
Reporter: tiger42 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 4.8.1
Severity: normal | Resolution:
Keywords: dev-feedback | Focuses: rest-api
--------------------------+------------------------------
Changes (by rmccue):
* keywords: => dev-feedback
Comment:
Hi @tiger42, and thanks for the report. I don't think this is a bug in the
code, although we might be missing some documentation here.
How are you sending the file to the REST API? There are two ways you can
pass files to the API:
1. Send the file's data in the request body (raw mode). This also requires
setting the Content-Disposition header to pass the filename.
2. Send the file in multipart mode (upload mode). This needs to be passed
via the `file` parameter in a `multipart/form-data` request.
It appears that you're using upload mode here, but not setting the
parameter name to `file`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41774#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list