Page 1 of 1

Saving uploaded content

Posted: Fri Mar 02, 2007 3:57 am
by onion2k
This topic here made me realise something: viewtopic.php?t=64458

Where do you save user generated content to? In the topic the poster is saving images to images/news. That's something I would never do. The images directory on a site I write is specifically for static images that I've created as part of the site design. I gather all the user content together in a single place away from the things I control, usually in a /content/ directory or subdomain, and organised by type or section, eg /content/pdf/ or /content/news/. The reason I do this is simple: it means I can take a copy of the website content and neatly slot it into a new version, or save it as a back up, or such incredibly quickly without having to work out what's user content and what's my content.

But is that the best approach? What other solutions have people come up with?

Posted: Fri Mar 02, 2007 6:32 am
by Maugrim_The_Reaper
Save it to a specialised directory - mainly for your reasons too - but also so I can serve it from a separate subdomain (browser can parallel request) and also usually to keep it beneath the webroot where it can't be remotely called directly without going through a request gateway in the application code.

Posted: Fri Mar 02, 2007 6:54 am
by s.dot
Mostly all I've dealt with regarding uploads is images.

In which case I have two directories

/uploads/
/thumbs/

I give each user their own directory (which is their user id in the users table)

/uploads/1/somefile.jpg
/thumbs/1/somefile.jpg