Hi there, I am trying to upload image to files service, in the process I am running into following problems
-
When trying to upload using axios from react application, I am receiving 403 forbidden error, while other api works fine with the Api Key and Session Key I supply, here is my code for uploading my image is base64 encoded.
var filename=randomstring.generate();
filename=‘images/speakers/${filename}.png’;
var json={resource:[{name:filename,type:‘file’,is_base64:true,content:imagedata}]};var headers={headers: {
‘X-DreamFactory-Api-Key’: session.apiKey,
‘X-DreamFactory-Session-Token’: session.sessionToken,
‘Content-Type’: ‘image/png’
}}var url = “http://foo.com/api/v2/files/”;
var response=axios.post(url, json, headers);
response.then(
(response)=>{
console.log(“Success”);
},
(error)=>{
console.log(“Failure”);
}
); -
Since above doesn’t work, I tried dreamfactory service to upload, it does upload file but the image which comes is corrupted, see below
For 2. it was showing a black screen earlier then I removed data:image/png;base64, from image data, it showed 10% of image…
Please help.
Thanks.