UC File Management: Deleting files on the UC server

I use Uploadcare on my site for users to upload image file - and it’s great. I have artists that upload image files (1, 3, 10 or 30 or more) but one at a time. I want the artist to be able to manage their portfolio and delete files at their discretion by clicking on a [DELETE] button => [confirm the delete]. Then…

That triggers an event that fires a function to delete the file in three locations:

  1. The artwork file record in Xano (where the fileUUID is stored)
  2. Wefblow CMS (where data needed to sell prints lives) and
  3. The Uploadcare servers that populate my web pages with images.

There is no need to store files that are trash and no longer needed.

I’ve been able to address the Xano record within the Xano API function stack. The Xano function stack allows me to easily use third party cURL commands. I can assign API keys, the fileUUID and provide the headers and other variables within Xano to automate the DELETE function.

I haven’t seen a cURL command or anything like that in the Uplaoadcare documentation.

The UploadCare REST API does not appear to address deleting files specifically. I would welcome seeing an example of cURL command or even an example coded in JavaScript. EIther would work.

I’d even be willing to pay someone to create the cURL command. Just need it done by the staff at UC or the UC community.

Thanks in advance

Hi @David_Richardson,

Thanks for reaching out! You can delete a file from your project via the REST API. See Delete file to learn more.

This is what a cURL request would look like

curl --request DELETE \
  --url https://api.uploadcare.com/files/UUID/storage/ \
  --header 'Accept: application/vnd.uploadcare-v0.7+json' \
  --header 'Authorization: Uploadcare.Simple YOUR_PUBLIC_KEY:YOUR_SECRET_KEY'

Where UUID is a UUID of the file you delete, and YOUR_PUBLIC_KEY and YOUR_SECRET_KEY are your API keys. You can find your API keys on the API Keys page in your account dashboard

Also, you can delete up to 100 files with a single request. See Batch file delete.

thanks my issue has been fixed.

1 Like