Upload large files to Django in multiple chunks, with the ability to resume if the upload is interrupted.
Project description
This simple django app enables users to upload large files to Django in multiple chunks, with the ability to resume if the upload is interrupted.
This app is intended to work with JQuery-File-Upload by Sebastian Tschan (documentation).
License: MIT-Zero
This is forked from the wonderful work done in django-chunked-upload.
Installation
Install via pip:
pip install django-chunky-upload
And then add it to your Django INSTALLED_APPS
:
INSTALLED_APPS = (
# ...
'chunky_upload',
)
Typical usage
- An initial PUT request is sent to the url linked to
ChunkedUploadView
(or any subclass) with the first chunk of the file. The name of the chunk file can be overriden in the view (class attributefield_name
). Example:
{
"my_file": "<File>"
}
- In return, server will respond with the
upload_id
, the currentoffset
and the when will the upload expires (expires
). Example:
{
"upload_id": "5230ec1f59d1485d9d7974b853802e31",
"offset": 10000,
"expires": "2013-07-18T17:56:22.186Z"
}
- Repeatedly PUT subsequent chunks using the
upload_id
to identify the upload to the url linked toChunkedUploadView
(or any subclass). Example:
{
"my_file": "<File>"
}
-
Server will continue responding with the
upload_id
, the currentoffset
and the expiration date (expires
). -
Finally, when upload is completed, a POST request is sent to the url linked to
ChunkedUploadView
(or any subclass). This request must include the themd5
checksum (hex). Example:
{
"md5": "fc3ff98e8c6a0d3087d515c0473f8677"
}
- If everything is OK, server will respond with status code 200 and the data returned in the method
get_response_data
(if any).
Possible error responses:
- User is not authenticated. Server responds 403 (Forbidden).
- Upload has expired. Server responds 410 (Gone).
upload_id
does not match any upload. Server responds 404 (Not found).- No chunk file is found in the indicated key. Server responds 400 (Bad request).
- Request does not contain
Content-Range
header. Server responds 400 (Bad request). - Size of file exceeds limit (if specified). Server responds 400 (Bad request).
- Offsets does not match. Server responds 400 (Bad request).
md5
checksums does not match. Server responds 400 (Bad request).
Helpful Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-chunky-upload-1.0.3.tar.gz
.
File metadata
- Download URL: django-chunky-upload-1.0.3.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 973c8998ac470b2ca02d83254b1a47a09cdb45540eab041de8c778724a4de382 |
|
MD5 | ca55012e2f8a579dcea8efeb3784b43d |
|
BLAKE2b-256 | ddda6d470b4e8e38d6a91fe718168ceb099f0a91b0e1da81e5f845b56cb82aa3 |
File details
Details for the file django_chunky_upload-1.0.3-py3-none-any.whl
.
File metadata
- Download URL: django_chunky_upload-1.0.3-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 604b52cfab0fe8d621c22f131e538d12f0a8ac1d1b235857b72f677a3d43aec4 |
|
MD5 | 3cbf70907c37b633885e79e8248b1513 |
|
BLAKE2b-256 | 1c9c1d6652598a0489e42197afcac19b328dd0af35d4b14fa480eee315ab439f |