Opened 10 years ago

Closed 10 years ago

#444 closed defect (invalid)

FileField returns error when updating

Reported by: ilikeprivacy@… Owned by: adrian
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: UI/UX:

Description

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 10 years ago by ilikeprivacy@…

  • Severity changed from normal to minor

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 10 years ago by adrian

  • Resolution set to invalid
  • Status changed from new to closed

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