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

**URL:** <https://community.weweb.io/t/how-to-programmatically-delete-files-uploaded-to-wewebs-cdn/1962>\
**Category:** Ask us anything\
**Tags:** file-upload\
**Created:** [March 3, 2023, 5:02pm UTC](https://community.weweb.io/t/how-to-programmatically-delete-files-uploaded-to-wewebs-cdn/1962 "2023-03-03T17:02:31Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Dominic](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dominic/32/5645_2.png) [@Dominic](https://community.weweb.io/u/Dominic)\
**Post date:** [May 11, 2023, 11:23am UTC](https://community.weweb.io/t/how-to-programmatically-delete-files-uploaded-to-wewebs-cdn/1962/12 "2023-05-11T11:23:58Z")

</div>

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 🙂

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}”  
}  
})

---

_[View the full topic](https://community.weweb.io/t/how-to-programmatically-delete-files-uploaded-to-wewebs-cdn/1962)._
