Understanding how uploading images and files work

Hello all! :slight_smile:
Due to storage limitations, I was wondering how uploading images/files work. As I understand, everytime, user uploads a new image to the forum, it saves it somewhere. The question is where exactly? Also, what if admin or user removes that image from the topic, will this image be removed from that storage area? (if it is, will it remove the image right away or will it wait for a period of time).
Thank you :stuck_out_tongue:

1 Like

At /var/discourse/shared/standalone/uploads/default/ on the server.

Yes as long as clean up uploads is enabled.

Upload will be removed after clean orphan uploads grace period hours.


Thanks for explaining :slight_smile:
What if user will try to do some sort of โ€œabuseโ€ like upload bunch of images and remove each one after a few seconds. They all will be saved in the ../default directory and I could ran out of storage?

Discourse new users can only upload one image per topic. Also image max size is just 4MB, so to fill a coupe of gigabytes a user will need a lot of images, and since we deduplicate uploads it will need to be all different. There is also min trust to post images that can be tweaked to TL2 if new accounts cause you problems.

If you canโ€™t afford user uploads just disable them and tell your users to publish those in sites like https://imgur.com/ like Reddit did for years.


The 4MB limitation is also true of documents like PDF?

No, PDF arenโ€™t images. Those are handled as files and follow the max attachment size kb site setting.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.