Accessing previous uploads


(SketchUp Community Manager) #1

I have this question from someone on my community forum:

“Is there a way to browse through and obtain a url for previous uploads (pictures, models) to the site associated with our logon? That would allow these items to be reused (or re-referenced), avoiding storage of duplicate data.”

Any ideas? Cheers!
AlexB


(Gerhard Schlager) #2

Discourse calculates a hash for each file and is therefore able to recognize when a file gets uploaded multiple times. So, each file is stored only once.

Unfortunately there is not list of uploads that I know of. (Please correct me if I’m wrong).
But, you can reuse the link from another post if you don’t want to upload the file again .
You can copy the link from every post and insert it into your own. Just look at the raw text from the post.

Let’s take the following post from try.discourse.org as an example:
Can I upload attachments? - discourse - Demo

You can copy the link from the raw text by going to http://try.discourse.org/raw/123/2
There you’ll find the link to an attachment like this: <a class="attachment" href="/uploads/try2_discourse/102/ec5829847a91b748.log">mysqld.log</a><span class="size">(18.6 KB)</span>

If you look closely, you can see the hash value in the filename (c5829847a91b748).


(Mittineague) #3

Maybe the uploads table could be useful?

CREATE TABLE uploads (
    id integer NOT NULL,
    user_id integer NOT NULL,
    original_filename character varying(255) NOT NULL,
    filesize integer NOT NULL,
    width integer,
    height integer,
    url character varying(255) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    sha1 character varying(40),
    origin character varying(1000),
    retain_hours integer
);

(Sam Saffron) #4

We can obtain a list of all the original users who uploaded a file (barring de-duping) this is however not exposed in the UI anywhere.

We would have to write an ad-hoc query. Keep in mind that out of the box:

  1. We delete all “orphan” uploads “clean orphan uploads grace period hours” in site settings after 1 hour.
  2. We delete all “deleted” uploads (once no longer attached to a post) “purge deleted uploads grace period days” after 30 days.

I think the best way of giving this kind of feature without feature creep is simple allowing for a custom search operator:

For example something like: user:me with:uploads to find all my posts containing uploads.


(Jeff Atwood) #5

Maybe but every post with an image would show up as “with upload” and I don’t think that is how people think of it.


(Sam Saffron) #6

with:uploads:.xls :slight_smile:


(Jens Maier) #7

So… basically file:xls?
(And file:* for everything.)