Skip to content

PHP WordPress Rest API Example

Justice Ogbonna edited this page Jun 26, 2017 · 3 revisions

In the front-end

Upload.upload({
    url: 'wp-json/wp/v2/media', 
    method: 'POST',
    file: file,
    headers: {
        "Content-Disposition": "attachment; filename:file-name.png",
        "content-type": "image/png",
        "data-binary": "@/home/user/file-name.png"
})
Clone this wiki locally