How to delete uploaded files

(Darix) #1

For testing the CR2 upload bug we tried to upload a lot of CR2 files which vary between 30-60MB per file. During the testing we were wondering … how to delete files again, especially when you uploaded the file and then cancelled the reply. But we would like to clean up the files only uploaded for testing.

Locally uploaded files would be easy to clean up. As we use S3 … I wonder if discourse has something builtin for this.

(Jeff Atwood) #2

Unreferenced uploads get periodically deleted over time.

Otherwise uploads

  • submitted during draft post composition, that are never published

  • that are edited out of published posts later

… would hang around forever, wouldn’t they?

(Sam Saffron) #3

What happens is that we move the files into a tombstone area in s3 and then the policy we set nukes the file after it has been there for a bit.

Note all uploads are easy to remove from console Upload.find(upload_id).destroy will remove files from s3.