ok ,
I don’t have an image , my html created a image with canvas and return a data url ( base64) ,
this base64 I need to get the binary content ? and then to Backendless …
I would like an help with that,
The base64 content you get now is wrong. That’s the root of the problem. Backendless just saves what you send to us in a file. What you should do is go to the root of the problem.
Where do you obtain that base64 string from? What is the API call? Is it a library or something built into the browser? Have you researched their documentation? Tried an example where you made sure the value you get is valid? I think you need to try these things first before you start using the Backendless APIs.
Cheers,
Mark
ok , thanks a lot for your patience…
in my js im getting this base64 , and if I check the base64 its ok ,
so I need to find an api, or sum function in php or js that get the content of the base64 and pass it to Backendless …
right ?
again thanks a lot I will go to the root of the base64
Yes, if you’re using our REST API, then the request body must be a base64 encoded content of your file:
https://backendless.com/docs/rest/file_save_files_from_byte_arrays.html
$headers = ‘Content-Type: text/plain’; ?
content type should be ?
when im incoming the binary content im getting the base64 as I sent you …
I can’t understand what I missing .
image if my console before im encoding it to base 64
No. Content type is NOT text/plain
.
Have you checked the documentation link I shared with you? It says there:
I checked it , just asking to be sure .
ok , I will make more tested ,
and will write down back if have problems…
or if I success.
thanks again
binary as been encode to base64
content type to multipart/form-data
error 8002 .
its a progress . my code as the guide :
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘http://api.backendless.com/519D3627-53FA-5FD5-FF77-E3BB5B7F6900/FD09A50B-5126-6998-FFF6-2F14302CD300/files/binary/testfolder/save1.png?overwrite=true’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, ‘PUT’);
curl_setopt($ch, CURLOPT_POSTFIELDS, $image);
$headers = array();
//$headers[] = ‘Application-Id: 519D3627-53FA-5FD5-FF77-E3BB5B7F6900’;
//$headers[] = ‘Secret-Key: FD09A50B-5126-6998-FFF6-2F14302CD300’;
//$headers[] = ‘Content-Type: text/plain’;
$headers[] = ‘Content-Type: multipart/form-data’;
$headers[] = ‘Application-Type: REST’;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);
}
curl_close($ch);
echo $result;
Sorry, I do not understand PHP. Try using the curl command first and make sure it works that way. Our documentation provides an example of a CURL request for file upload. Once you confirm that it works with curl, then do the same thing in PHP…