# How to Delete Uploaded Files?

**URL:** https://meta.discourse.org/t/how-to-delete-uploaded-files/25001
**Category:** Support
**Created:** [February 9, 2015, 7:53am UTC](https://meta.discourse.org/t/how-to-delete-uploaded-files/25001 "2015-02-09T07:53:55Z")
**Posts on this page:** 1
**Showing post:** 28

<div class="post-metadata">

### Author: ![tanius](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tanius/32/135041_2.png) [@tanius](https://meta.discourse.org/u/tanius)
#### Post date: [July 10, 2022, 12:26pm UTC](https://meta.discourse.org/t/how-to-delete-uploaded-files/25001/28 "2022-07-10T12:26:38Z")

</div>

I also had to somehow delete an uploaded file. We don’t have the cleanup task enabled as some files come from an import from a different forum software and have not yet been referenced in imported posts correctly. So I needed to find a manual way. The following works but is not pretty …

1. Make sure the relevant upload is no longer in the current version of any post. That way, Discourse will consider it orphaned and not make trouble when you delete it.

2. Use the [Data Explorer plugin](https://meta.discourse.org/t/32566) or a different way to query the Discourse database to list orphaned uploads, find the relevant one, and note down its upload\_id and filename. Relevant query:

3. In the database or with the [Rails console for Discourse](https://meta.discourse.org/t/15927/1), delete the concerned record from table `uploads` by its upload ID. Here I use the Rails console:

4. Delete the associated file incl. all optimized versions (if any, applies to images) from the file system via SSH. Note the wildcard added before the file extension to also catch optimized versions, which have a suffix here. Of course,

---

_[View the full topic](https://meta.discourse.org/t/how-to-delete-uploaded-files/25001)._
