List of all uploaded files

Hello friends,

what are you thinking about some extra tab at the admin interface to keep control over the current disk usage, files sizes, click rates, filtering them after extension and searching for specific terms?

I wish, I could get more control over all attachments.



That’s something I definitely want done. Not sure when though.


Sounds useful!

There is a bunch of product questions around how this could/should work in my mind. It looks like a problem that has been already figured out or solved in other forum software, but I wonder how will this be framed / built around Discourse’s philosophy.

I am also wondering more about the manifestations of providing uploads settings, e.g.: if you chose to introduce extension configuration, the composer needs to cater for this when users are selecting/uploading attachments, and so on. Also, whether this should be in core, or as a plugin.

On the bright side, if we ignore all questions / assumptions / product / design considerations, it doesn’t look like it is technically tricky, I made a one hour spike here (this is very immature implementation though :blush:).

You can definitely extend this with a bunch of useful features: settings, search / filtering, sorting, etc (and some other considerations like supporting pagination, …)


If youbtalking about admin tools. You can considure usong plugin data explorer whic allows admins to query database. When I hunting free space I am querying db there is table uploads whic gives you size location and other useful things. Also one good thing is that deleating rows from uploads also dealeting files. Becouse ther is sidekiq job pruge oprhan uploads.

I am totally open to adding something here, but I feel a top level tab is a bit too much .

Conceptually this feels like a “report” to me with a drilldown vs a section for uploading things.

I would like to see this link to the new report

When I think about this problem I think the main use case is around admins trying to get a handle on the … upload problem…

  • Why do I have so many uploads?

  • Which users have the most/largest uploads ?

  • What are the 100 biggest uploads on my forum?

  • How many things were uploaded in the last month? That way I can keep track of trends.

@codinghorror / @joffreyjaffeux what are your thoughts here?


Yes I agree it could be a report, we might have to start working on the filtering logic I talked with you months ago. But other than that it should be good.


Great line of questioning @sam !

I think perhaps I lack some context on what is the admin’s job / use case for the upload problem, but it appears to be (if there is any research or perhaps admin opinions to confirm that, it would be great!) that it can be framed as: I am an Admin, I want to gain understanding of my instance’s uploads usage.

I wonder if there are any after actions when the job / use case is satisfied. For example, if the admin notices a problem or a trend, will the admin/site_settings/category/files is the place they can optimise their file uploading strategy?

Also, I agree that the Uploads section is heavy as a top level tab for this use case.

Any news about this topic?

Im looking for a option to look through the uploaded files.


I guess, sorting and listing files isn’t as much as important for Discourse as for us. :see_no_evil:

Similar issue:

Here are some Data Explorer queries for getting details about post uploads. Possibly something similar could be added to the admin reports section for sites that don’t have the Data Explorer plugin installed. Let me know if this data is not what you are looking for.

Which users have the most/largest uploads?

Returns the user, their upload count, and their total uploads in kb rounded to 2 decimals. The join on the users table is to prevent data from deleted users from being returned. Results are ordered by total upload size in descending order.

COUNT(ul.user_id) AS upload_count,
ROUND(SUM(ul.filesize) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON = pul.upload_id
JOIN users u
ON = ul.user_id
GROUP BY ul.user_id
ORDER BY total_kb DESC

What are the 100 biggest uploads on my forum?

Returns the user, the post with the upload, and the upload’s file size in kb. Results are ordered by upload size in descending order.

ROUND(ul.filesize / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON = pul.upload_id
JOIN users u
ON = ul.user_id
ORDER BY total_kb DESC

Uploads for past 30 days

The query requires you to supply an :end_date parameter. The date should be in the form ‘yyyy-mm-dd’. For example ‘2020-01-08’. It returns results for the 30 period that ends with the end_date. It returns the day, upload count, and the day’s total uploads in kb for any days in the period that have post uploads. Results are ordered by day.

-- date :end_date

ul.created_at::date AS day,
COUNT(1) AS upload_count,
ROUND(SUM(ul.filesize) / 1000.0, 2) AS daily_upload_kb
FROM post_uploads pul
JOIN uploads ul
ON = pul.upload_id
WHERE ul.created_at::date BETWEEN :end_date::date - INTERVAL '30 days' AND :end_date
GROUP BY ul.created_at::date
ORDER BY ul.created_at::date DESC