How to programmatically delete files uploaded to WeWeb's CDN?

I’m using the method mentioned by @dorilama. It works pretty well. Here is my working JS code bound to the submit button. Since I only need single file if you need to upload multiple files you will have to modify the code.
And remember that you have to enter the bucket-name, otherwise it won’t work :slight_smile:

var formData = new FormData();
var fileSource = wwLib.getFrontDocument().querySelector(“#myfile input”); //myfile is an id for upload element
var fileName = variables[/* myfile - value */ ‘76f7137e-d80e-483c-824b-a62a324f7554-value’][‘name’]; //this is variable which contains fileName from upload element
formData.append(“content”, fileSource.files[0]);
return await axios.post(“https://{your-supabase-account}.supabase.co/storage/v1/object/{bucket-name}/”+fileName, formData,{
headers:{
“Content-Type”: “multipart/form-data”,
“Authorization”: “Bearer {your auth token}”
}
})

1 Like