Opened 11 years ago

Closed 10 years ago

#652 closed enhancement (wontfix)

An option to upload files into database would be a great alternative to filesystem uploads.

Reported by: cygnus@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: normal Keywords: upload
Cc: cygnus@…, dev@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The filesystem-only method of uploading files for meta.FileField and meta.ImageField is understandable, but a method of using FileFields and ImageFields to upload into a database (as BLOBs, large objects, BYTEA values, etc.) would be extremely useful when filesystem storage is not desirable. Is this feasible? Some thoughts are:

  • Use kwargs to the ImageField and FileField constructors to specify the image storage backend
  • If storing files in the database, create a table (say, a "binary storage table") as part of django-admin.py sqlall that stores the files in a format that is appropriate for the database backend (e.g. BLOB for MySQL, BYTEA or large object for PostgreSQL)
  • User-defined fields that store images or files actually store an ID referring to a record in the binary storage table
  • Database abstraction layers will need to implement some methods to use for storing and loading files from the database so ImageField and FieldField objects can retrieve them in a general way

Attachments (1)

jboss-web.xml (422 bytes) - added by anonymous 10 years ago.
fdfdfd

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by Adrian Holovaty

Resolution: duplicate
Status: newclosed

Duplicate of #250.

comment:2 Changed 11 years ago by cygnus@…

Resolution: duplicate
Status: closedreopened

This ticket's topic is similar to #250, but it's different in a pretty big way; can we dicuss?

comment:3 Changed 11 years ago by hugo

Maybe we could have something like abstract "filestorages". The default one would be like what django does now - storing in the filesytem below MEDIA_ROOT. FileFields could get a filestorage=xxxx keyword to switch to some other filestorage. A file storage would need hooks to save a file and to return the files URL - a database filestorage would need to reference a view function, of course, as the database isn't directly accessible by the webserver.

comment:4 Changed 10 years ago by anonymous

Owner: changed from anonymous to Adrian Holovaty

comment:5 Changed 10 years ago by Adrian Holovaty

Resolution: duplicate
Status: newclosed

Duplicate of #250.

comment:6 Changed 10 years ago by Adrian Holovaty

milestone: Version 0.93

Milestone Version 0.93 deleted

Changed 10 years ago by anonymous

Attachment: jboss-web.xml added

fdfdfd

comment:7 Changed 10 years ago by Noah Slater <nslater@…>

Resolution: duplicate
Status: closedreopened

This is NOT a duplicate of #250 as that is marked as a duplicate of #2417 and that is specifically stated to not apply to FileField and ImageField:

http://code.djangoproject.com/ticket/2417#comment:5

comment:9 Changed 10 years ago by Simon G. <dev@…>

Cc: dev@… added
Resolution: wontfix
Status: reopenedclosed
Triage Stage: UnreviewedDesign decision needed

Given the discussion on the list above, I've marked this as wontfix for the time being. It shouldn't be too hard to implement yourself if you do need this functionality, however, if someone wants to write up a proposal / initial code for this, then please do so and re-open.

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