#20196: Better support for folder uploads -------------------------------+-------------------- Reporter: jonash | Owner: nobody Type: New feature | Status: new Component: Uncategorized | Version: Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- Feature request: Make folder uploads (`<input type=file webkitdirectory>`) possible in Django.
Here are some of my ideas regarding design and implementation. == Database, forms == Add a new `FolderUploadField` that stores the path where the folder has been uploaded to, similar to how `FileUploadFields` work. The object you deal with in business logic code is a `Folder` object, the `File` equivalent. == `QueryDict` == Add a `QueryDict.getfolder` method that returns a `(Uploaded)Folder` object. Note that multi-file and folder uploads are not distinguishable in POST data, so we should have some sanity checks before constructing that object. At the very least we should check that all file paths have a common folder prefix: `["foo/bar.jpg", "foo/spam.txt"]` is okay while `["foo/bar.jpg", "spam/eggs.txt"]` is not. == `Folder` object == Constructed from list of `File` objects, it should at least have these two methods: * `.walk()` behaves similar to `os.walk` but yields `File` objects * `.save(dest)` saves the whole folder in its original structure under `dest`. == Testing == Special handling is required to properly encode `Folder` objects in the test client. -- Ticket URL: <https://code.djangoproject.com/ticket/20196> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.