# List of all uploaded files

**URL:** https://meta.discourse.org/t/list-of-all-uploaded-files/63714
**Category:** Feature
**Tags:** planned
**Created:** [1 juni 2017 om 07:51 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714 "2017-06-01T07:51:00Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [1 juni 2017 om 07:51 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/1 "2017-06-01T07:51:00Z")

</div>

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.

Best

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [1 juni 2017 om 10:19 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/2 "2017-06-01T10:19:25Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Tarek\_Khalil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarek_khalil/32/125517_2.png) [@Tarek\_Khalil](https://meta.discourse.org/u/Tarek_Khalil)
#### Post date: [1 december 2018 om 09:41 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/3 "2018-12-01T09:41:59Z")

</div>

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](https://github.com/discourse/discourse/pull/6709) (this is very immature implementation though 😊).

 ![Discourse%20Uploads](https://global.discourse-cdn.com/meta/original/3X/8/0/80ecdd415ec39897ffc2ffea4ba8c178987829eb.gif)

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

---

<div class="post-metadata">

### Author: ![adopilot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adopilot/32/105040_2.png) [@adopilot](https://meta.discourse.org/u/adopilot)
#### Post date: [1 december 2018 om 14:14 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/4 "2018-12-01T14:14:23Z")

</div>

If youbtalking about admin tools. You can considure usong plugin [data explorer](https://meta.discourse.org/t/32566?silent=true) 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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2 december 2018 om 22:57 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/5 "2018-12-02T22:57:43Z")

</div>

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

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/e/ced1aa79d39f4bcd79a7ee115213143bb47f1e51.png)

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 / @j.jaffeux what are your thoughts here?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [3 december 2018 om 10:30 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/6 "2018-12-03T10:30:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Tarek\_Khalil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tarek_khalil/32/125517_2.png) [@Tarek\_Khalil](https://meta.discourse.org/u/Tarek_Khalil)
#### Post date: [3 december 2018 om 17:01 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/9 "2018-12-03T17:01:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![frold](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/frold/32/82547_2.png) [@frold](https://meta.discourse.org/u/frold)
#### Post date: [23 december 2019 om 19:05 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/10 "2019-12-23T19:05:45Z")

</div>

Any news about this topic?

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

---

<div class="post-metadata">

### Author: ![terraboss](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/terraboss/32/381157_2.png) [@terraboss](https://meta.discourse.org/u/terraboss)
#### Post date: [23 december 2019 om 23:14 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/12 "2019-12-23T23:14:21Z")

</div>

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

Similar issue:

> [@Issue with adding attachments inside table cells](https://meta.discourse.org/t/issue-with-adding-attachments-inside-table-cells/135607):
>
> Hi there, it seems, it’s not possible any more, to add attachments inside tables. Any idea how to fix this? Example Name File bla bla [bla.docx | Name | File | | --- | --- | | bla | bla | | | [bla.docx|attachment](upload://hu8jvVTNiCjzn5XmxXRnhUaRINy.docx) (22.4 KB) | It is because of the seperator “|” between file name and the function name attachment. I really need this, to keep things clean and organised

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [8 januari 2020 om 23:57 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/13 "2020-01-08T23:57:37Z")

</div>

Here are some [Data Explorer](https://meta.discourse.org/t/32566?silent=true) 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](https://meta.discourse.org/t/32566?silent=true) 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.

#### Including optimized images

```sql
WITH uploads_with_optimized AS (
SELECT
ul.user_id,
ROUND((SUM(COALESCE(oi.filesize, 0)) + SUM(ul.filesize)) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
LEFT JOIN optimized_images oi
ON ul.id = oi.upload_id
GROUP BY ul.user_id
)

SELECT
uwo.user_id,
COUNT(uploads.user_id) AS upload_count,
total_kb
FROM uploads_with_optimized uwo
JOIN uploads
ON uploads.user_id = uwo.user_id
GROUP BY uploads.user_id, uwo.user_id, total_kb
ORDER BY total_kb DESC
LIMIT 50

```

#### Excluding optimized images

```sql
SELECT
ul.user_id,
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 ul.id = pul.upload_id
GROUP BY ul.user_id
ORDER BY total_kb DESC
LIMIT 50

```

### 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.

#### Including optimized images

```sql
SELECT
ul.user_id,
pul.post_id,
ROUND((SUM(oi.filesize) + ul.filesize) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
JOIN optimized_images oi
ON ul.id = oi.upload_id
GROUP BY oi.upload_id, ul.user_id, pul.post_id, ul.filesize
ORDER BY total_kb DESC
LIMIT 100

```

#### Excluding optimized images

```sql
SELECT
ul.user_id,
pul.post_id,
ROUND(ul.filesize / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
ORDER BY total_kb DESC
LIMIT 100

```

### 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.

#### Including optimized images

```sql
--[params]
-- date :end_date

SELECT
ul.created_at::date AS day,
COUNT(1) AS upload_count,
ROUND((SUM(COALESCE(oi.filesize, 0)) + SUM(ul.filesize)) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
LEFT JOIN optimized_images oi
ON ul.id = oi.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

```

#### Excluding optimized images

```sql
--[params]
-- date :end_date

SELECT
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 ul.id = 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

```

---

<div class="post-metadata">

### Author: ![jochen\_weber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jochen_weber/32/167516_2.png) [@jochen\_weber](https://meta.discourse.org/u/jochen_weber)
#### Post date: [24 februari 2020 om 00:27 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/14 "2020-02-24T00:27:16Z")

</div>

I’m a new (meta) community member, and have recently taken over the admin duties for another community using Discourse (and hosted by Discourse). On the dashboard, I just saw a “jump” in the space that the Uploads are using (from about 0.7GB to 1.2GB). It seems the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) is only available for Business plans or higher… Would there be any other way of finding out what recent files are using the additional 0.5GB?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [24 februari 2020 om 01:23 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/15 "2020-02-24T01:23:51Z")

</div>

> [@jochen\_weber](#):
>
> I just saw a “jump” in the space that the Uploads are using (from about 0.7GB to 1.2GB).

This is entirely my fault.

We had a big bug in the past where we were not properly counting size of all uploads.

When a user uploads an image we often resize it up to 3-4 times for various resolutions and optimization. These optimized images are stored in the cloud and still cost storage space.

To see the actual images you would:

```plaintext
SELECT * FROM optimized_images

```

@simon maybe update the above to account for optimized\_images?

---

<div class="post-metadata">

### Author: ![jochen\_weber](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jochen_weber/32/167516_2.png) [@jochen\_weber](https://meta.discourse.org/u/jochen_weber)
#### Post date: [24 februari 2020 om 15:06 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/17 "2020-02-24T15:06:37Z")

</div>

> [@sam](#):
>
> We had a big bug in the past where we were not properly counting size of all uploads.

Ah, that makes a lot of sense. I did briefly wonder if that might be the case–after I wrote the post here 😉

Hmmm, maybe it’s worth adding a brief sentence to that effect on the storage gauge on the dashboard, so people don’t think someone is siphoning off their storage space with unknown data 😉

And if you ever create an “Uploads inspector” that doesn’t require the Business plan plugins, that’d be super appreciated!!

Cheers!

---

<div class="post-metadata">

### Author: ![karagah\_majazi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karagah_majazi/32/205327_2.png) [@karagah\_majazi](https://meta.discourse.org/u/karagah_majazi)
#### Post date: [15 maart 2021 om 12:58 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/18 "2021-03-15T12:58:11Z")

</div>

finally I didn’t understand how can I see list of member’s upload in different subjects and post!!??

---

<div class="post-metadata">

### Author: ![robbie.morrison](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robbie.morrison](https://meta.discourse.org/u/robbie.morrison)
#### Post date: [1 november 2021 om 06:53 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/19 "2021-11-01T06:53:11Z")

</div>

I would like to browse the uploaded files directory. My particularly use case is to investigate the details of this linkrotted&nbsp;URL:

- [https://forum.openmod.org/uploads/short-url/1ATLh9pa3Zmjf9V6aKMDRpRIArG.pdf](https://forum.openmod.org/uploads/short-url/1ATLh9pa3Zmjf9V6aKMDRpRIArG.pdf)

Any interpreted admin support to do so would be a great help. Or have I missed something? With best wishes,&nbsp;R

---

<div class="post-metadata">

### Author: ![robbie.morrison](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robbie.morrison](https://meta.discourse.org/u/robbie.morrison)
#### Post date: [20 februari 2023 om 10:29 UTC](https://meta.discourse.org/t/list-of-all-uploaded-files/63714/20 "2023-02-20T10:29:55Z")

</div>

Another **workaround** is to:

- create and download a **site backup** with “include uploads”
- navigate to that archive and unzip it, say from the command line: `$ tar -xvzf xxxx.tar.gz`
- swap to the uploads directory: `$ cd uploads`
- select between original and optimized sections and explore the resulting file tree
- none of the upload names are present, all names deploy random (or encoded) strings

A GUI interface on the admin portal would provide a nicer UX. So my vote is for that functionality.&nbsp;R
