File Reference and Deletion, will it really be deleted?

I have a small server with only 20G of storage with my Discourse running on it. So I can’t let people upload too big files——of course if it is very important it should still be uploaded, but if not so important, it should not.

So I set the biggest upload file size 100M.

But I see many not so important files uploaded and the back-up quickly increases.

Here is a really small file I uploaded as an example:

try file.csv (6 字节)

with codes to be

<a class="attachment" href="//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/f/8/f8c1d87006fbf7e5cc4b026c3138bc046883dc71.csv">try file.csv</a> 

What if I just delete such codes. Will the file “try file.csv” really be deleted from the server and will not cause any more burden on Discourse Backup File?

If clean up uploads is enabled, all uploads not referenced in posts will be removed after clean orphan uploads grace period hours.

If space is a problem, isn’t 100MB files a little too much? 5 or 10MB is enough most times.

6 Likes

Consider setting up:

2 Likes

Does this also affect attachments referenced in deleted posts?

Yes. If a post completely deleted and removed from database and it’s attachments not referenced anywhere else then it will be removed.

1 Like

…so that means that “deletion” in the UI or editing the post so only an old revision contains the link is not enough to get a file removed, right?

From my understanding of the current code

If admin can see a post even after deletion (in soft delete or hidden mode) then it means post is not deleted in db. Then it will not removed.

In this case the media will be removed.

3 Likes

Hi @vinothkannans

Could you please confirm that, in the latest versions (v.2.0.2 and so), when an administrator deletes topics/posts with attachments from UI, either individually or in bulk, those attachments are never removed from the server?

In case they aren’t, what’s the best approach to totally removed from server?

Cheers,
Ismael

Also there are many other related topics.

2 Likes

Yes, exactly, that’s what I was looking for :ok_hand:

Thank you very much!

when are uploaded files to private messages are deleted?

Additionally, it would be great to have something like a “self-destroying” private message which will delete the sender and receiver message including the attached files after X hours /days.

1 Like