Opened 20 years ago
Closed 20 years ago
#444 closed defect (invalid)
FileField returns error when updating
| Reported by: | 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 |
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 by , 20 years ago
| Severity: | normal → minor |
|---|
comment:2 by , 20 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
The MEDIA_ROOT only applies for file-uploads in the admin. On your live site, you can put uploaded files wherever you want.
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.