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

Hi everyone,

Uploading files to WeWeb’s CDN is super easy with the File Upload component. But once that is done, how can we manage those files programmatically?

More specifically, I need to trigger the deletion of files stored in WeWeb’s CDN (File Storage) from within a workflow. How can I do that?

If not possible, what other options/approaches are available (other than manually deleting them or using a third party service)?

And as a last resort, is there any way to batch delete? The interface currently only allows for deleting files one by one, if I’m not mistaken…

Thanks,

2 Likes

Hey @gbeaudoin :wave:

I’m not sure actually. Let me check with the team and get back to you on that one :slight_smile:

1 Like

Hi Joyce, is it possible to delete files from CDN with a workflow?

1 Like

Hello :wave:

It’s not possible currently but I’ve just created two product tickets.

Could you give me a bit more information about your use cases so that I can provide more context to the tech team?

On our end we’re using Weweb’s storage as a temporary environment. Using a workflow, a file gets uploaded to Weweb’s CDN, then we grab the public URL and pass it to an external service. This external services downloads the file and acts on it.

Once that is done, we no longer need to keep the file on the CDN.

Programmatically deleting the file allows for:

  • More space available as we can delete what we don’t need right away
  • It takes much less time to manage as we don’t have to manually delete files (clicking the “delete” buttons one by one)
  • It is also more secure as there are no public URLs to private files lying around
3 Likes

Perfect. Thanks for the detailed answer @gbeaudoin :pray:

I’ve added it to the ticket so the product team has a clear understanding of the need.

There may be a workaround in the meantime (to send the file directly to the external service without uploading to WeWeb’s CDN). Could you share what external services need to access the files uploaded by the user?

1 Like

Hi Joyce,

Us using Weweb’s CDN is actually a temporary solution to workaround an issue with Xano that refuses to save some files (PDFs and JPGs) because they are partially malformed (although they open fine on desktop).

When this happens, we need to store the file somewhere else, send it to a PDF conversion service, then add it back to Xano.

I know that we could use any other cloud storage solution, but we want to minimize the quantity of provider for any given project.

Thanks :slight_smile:

1 Like

Got it :ok_hand:

@Joyce any news about being able to delete files that have been uploaded to the weweb?

1 Like

And/or any update on how to use Supabase’s storage directly?

you can use some code in a javascript action to upload to supabase directly.
See this example, it’s for xano but it can be used for supabase too.

1 Like

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

No news on this. There are two open tickets on the product roadmap based on this thread but they are not prioritized yet.

The two tickets:

  1. It would be nice to have a workflow action to delete files that were previously uploaded to WeWeb
  2. It would be nice if we could select multiple files that were uploaded to WeWeb and delete them all at once instead of having to manually delete them one by one
2 Likes

Hello, any news on the ability to delete uploaded weweb CDN files using the workflow?

Hi @uday-kea :wave:

Yep.

The tech team is currently exploring a big ticket to improve file management in WeWeb, including deleting files that have been added to our CDN, but also making it easier to upload images directly to your own backend.

In terms of timeline to release the improvements, it’s too early to say because they’re still in the exploration phase. We’re hoping end of year but it could be delayed depending on technical obstacles and how other big tickets move forward like the marketplace and components.

3 Likes

My vision of the best scenario:

  1. In the project settings, we set a storage option: permanent/temporary. If temporary, set expire time in seconds.
  2. If we have a ‘temporary’ setting, we can call an action to set ‘permanent’ flag to the uploaded file.
  3. We can observe/manage uploaded files and see the uploader (anon/logged/admin).
1 Like

Is there any update on this, @Joyce ?

I would like to display the user’s profile photo temporarily when they edit their profile and only send it to the backend if they click save changes. If he cancels the sending or closes the popup, I would like to delete it from the Weweb storage

Thanks! :pray:

Hi @lianr7 :wave:

We haven’t prioritized the “programmatically delete files uploaded to WeWeb’s CDN” feature yet.

However, you now have more options to work with files so you should be able to achieve the UX you describe without ever uploading the users’ files to WeWeb’s CDN :slight_smile:

The “Encode file as Base64” action is backend-agnostic. If you’re working with a Supabase backend, there are several file storage actions available in workflows.