Skip to content

PHP WordPress Rest API Example

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

In the front-end

$scope.upload = function (file) {
            Upload.upload({
                url: 'http://localhost/wp-json/wp/v2/media',
                method: 'POST',
                file: file,
                headers: {
                    "Content-Disposition": 'attachment; filename=' + file.name,
                    "Content-Type": file.type,
                    "Cache-Control": "no-cache",
                    "Data-Binary": file.name
                }
            })
Clone this wiki locally