Support Topics Documentation Slack YouTube Blog

How can I remove an image from the files?

async deleteOrder(order){
var found = await Backendless.Data.of( “order” ).findById(order.id);
return Backendless.Files.remove( “’”+ found.map+"’");
}
map is a column in table “order” and it is a file reference contains a png file.
in this code we can’t remove the image cause found.map returns: ‘https://backendlessappcontent.com/..../files/img/orders/order55-0.7423398869778495-0.83942069806.png’ as example.

Hello @Pick_App

In documentation - Deleting a File
Please, try delete image use <path>/<filename> -

img/orders/order55-0.7423398869778495-0.83942069806.png

When the client sends a request I don’t know the file name, it is stored in database, so in the table I have the path as a link and this surely doesn’t work.

The structure of the file URL is this:

https://backendlessappcontent.com/<application id>/<REST-API-key>/files/<path>/<file name>

You can parse out the necessary part from the URL and use it in the API call to delete the file.

Regards,
Mark