Opened 16 years ago

Closed 13 years ago

#6352 closed (wontfix)

Admin interface should provide option for allowing the admin to specify the location of the file using a relative path. Currently it only allows the admin to upload a file.

Reported by: mueen@… Owned by: nobody
Component: contrib.admin Version: dev
Severity: Keywords: admin file FileField upload path
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here's the scenario I'm suffering from.

My model has a FileField. Basically, I need to create new instances from time to time. Each instance has two files - one about 15 MB and the other about 25 MB.

In the Admin interface, when I try to create a new interface, it wants me to upload the files. If I try that, I get a 500 Error - most likely the process is running out of memory (using FastCGI with Apache).

Now the database does not hold the whole file - only the relative path to it. If I could manually upload the file (FTP, etc), and simply supply the path in the Admin interface, my life would be made easier. As it stands, I have to manually edit the paths in MySQL. So it would be nice if the Admin interface provided both options: Uploading and specifying local paths.

Of course, this solution is not ideal (although it does make handling files more flexible). I'm told the reason I have this problem is that Django tries to keep the whole file in memory before it dumps it to disk. I don't know if there's a ticket open for it, but it would make more sense if Django would write to disk as it reads the file from the upload process. (I'll gladly accept any corrections to my reasoning - I'm Django newbie).

Change History (5)

in reply to:  description comment:1 by Collin Grady <cgrady@…>, 16 years ago

Replying to mueen@nawaz.org:

I'm told the reason I have this problem is that Django tries to keep the whole file in memory before it dumps it to disk. I don't know if there's a ticket open for it, but it would make more sense if Django would write to disk as it reads the file from the upload process.

See #2070 :)

comment:2 by mueen@…, 16 years ago

Thanks for the link. As I was using the latest SVN (at the time), and as the patch you refer to has been accepted into trunk, I take it that it was already there when I tried it.

So I'm not sure why I got 500 errors. Perhaps it still required more memory than my shared hosting is willing to provide? I guess I can ask them to increase the memory limits...

In any case, I chose to open this ticket to address the Admin interface. I think that even if the upload issue has been resolved, it is conceivable that the site maintainer may choose to physically move the file for some reason or other, and there should be an easy way to update the FileField information without having to jump into SQL.

This was meant to be more of a feature request than a bug report.

comment:3 by Collin Grady <cgrady@…>, 16 years ago

Accepted means it is a valid bug - you'll note that the bug is still open, so it is not in trunk yet.

And I wasn't trying to say this ticket is or isn't valid, just pointing you to the large upload issue :)

comment:4 by Simon Greenhill <dev@…>, 16 years ago

Triage Stage: UnreviewedDesign decision needed

comment:5 by Ramiro Morales, 13 years ago

Resolution: wontfix
Status: newclosed

I think this qualifies as an very edgy case, so I'm closing the ticket as wontfix.

You might want to try overriding the form widget for the form field associated with your model FileField using the documented mechanisms to achieve this (i.e. to be able to edit manually the path of the uploaded file on the server.)

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