Opened 13 years ago

Closed 13 years ago

#444 closed defect (invalid)

FileField returns error when updating

Reported by: ilikeprivacy@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: minor Keywords: filefield
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When uploading a file via filefield (in the admin interface) it works correctly, however if I attempt to edit and upload a new file I receive the error "Enter a valid filename.", on editing the filename/link above the filefield is the actual system path, it would be good if this was a relative path or similar.

I'm running via builtin server.

my filefield is specified as follows:

file = meta.FileField(upload_to="/tmp/")

Change History (2)

comment:1 Changed 13 years ago by ilikeprivacy@…

Severity: normalminor

Found the error, the directory you're uploading to needs to be under MEDIA_ROOT (which was blank in my case).

Doesn't seem correct that you are only allowed to upload into MEDIA_ROOT, eg. if you are accepting anonymous uploads which will go into a submission queue you don't necessarily want them publicly accessible until approved.

comment:2 Changed 13 years ago by Adrian Holovaty

Resolution: invalid
Status: newclosed

The MEDIA_ROOT only applies for file-uploads in the admin. On your live site, you can put uploaded files wherever you want.

Note: See TracTickets for help on using tickets.
Back to Top