Using wp.media().file( path )... returns arrray of photos insted of uploading one
pawix135 opened this issue · 1 comments
pawix135 commented
So I'm trying to upload image to the server via media method and insted of file getting it uploaded I get an array of objects in return.
const wp = new WPAPI({endpoint: 'https://xxx.com/wp-json', username: 'xxx', password: 'xxx'});
wp.media().file("/imiona/Dawid_pink_tinge_bialy.jpg").then( ( success ) => {
console.log(success);
}).catch( ( error ) => {{
console.log(error);
}});
Am I doing something wrong?
pawix135 commented
I'm sorry...