You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I can't seem to get a example for uploading an image properly using apiFetch..it creates and returns all the right datasets except the image uploaded is of 2 Bytes & responce has media_type as "file" & mime_type as "application/json" which i think should be instead 'image' & 'image/jpeg' respectively.
I am using this way to upload the file apiFetch({ path: addQueryArgs( apiPath ), method: 'POST', headers: { "Content-Disposition" : 'attachment;filename='+filename+'', "Content-Type" : "image/jpeg", }, data: imgLoc, }).then((res) => { product.images = [ { src: res.source_url, } ]; this.addProduct( product ); });
can u guys help me out here..i cannot find any solutions online.
Thanks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I can't seem to get a example for uploading an image properly using apiFetch..it creates and returns all the right datasets except the image uploaded is of 2 Bytes & responce has media_type as "file" & mime_type as "application/json" which i think should be instead 'image' & 'image/jpeg' respectively.
I am using this way to upload the file
apiFetch({ path: addQueryArgs( apiPath ), method: 'POST', headers: { "Content-Disposition" : 'attachment;filename='+filename+'', "Content-Type" : "image/jpeg", }, data: imgLoc, }).then((res) => { product.images = [ { src: res.source_url, } ]; this.addProduct( product ); });
can u guys help me out here..i cannot find any solutions online.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions