FileField upload directory

3 views
Skip to first unread message

Tristan King

unread,
Dec 12, 2007, 8:49:53 PM12/12/07
to Django users
Hi,

Is there a way to point the FileField upload directory to somewhere that
isn't under the MEDIA_ROOT ?

I want this because i want to be able to upload files, but not have them
accessible via the web.

I've worked around this by making a new url to the upload directory and
making a view which raises a Http404, which works fine, but I don't
think is an ideal solution.

I think having the upload_to directory point to a absolute file path
rather than one relative the the media_root dir would make more sense,
since users can specify the media_root if they wish, but it's not
enforced.

Any thoughts?
Thanks,
-Tristan

Malcolm Tredinnick

unread,
Dec 12, 2007, 8:56:16 PM12/12/07
to django...@googlegroups.com

On Thu, 2007-12-13 at 11:49 +1000, Tristan King wrote:
> Hi,
>
> Is there a way to point the FileField upload directory to somewhere that
> isn't under the MEDIA_ROOT ?

This type of question has been asked very frequently on the list in the
past. A number of solutions have been proposed on the list. Please at
least type the proposed subject line of your email into the search box
on http://groups.google.com/group/django-users/ so that we don't get
lots of repeated questions. Searching more broadly on Google will turn
up a lot of useful tips as well.

You'll also notice, if you expand your search a bit further, that
there's ongoing development work to make this all bit more "public API",
requiring less poking about under the covers.

Regards,
Malcolm

--
Why be difficult when, with a little bit of effort, you could be
impossible.
http://www.pointy-stick.com/blog/

Reply all
Reply to author
Forward
0 new messages