Skip to main content

Upload large files to Django in multiple chunks, with the ability to resume if the upload is interrupted.

Project description

Django Chunky Upload

Actions Status PyPi Version Coverage Status Code style: black

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

  1. 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 attribute field_name). Example:
{
  "my_file": "<File>"
}
  1. In return, server will respond with the upload_id, the current offset and the when will the upload expires (expires). Example:
{
  "upload_id": "5230ec1f59d1485d9d7974b853802e31",
  "offset": 10000,
  "expires": "2013-07-18T17:56:22.186Z"
}
  1. Repeatedly PUT subsequent chunks using the upload_id to identify the upload to the url linked to ChunkedUploadView (or any subclass). Example:
{
  "my_file": "<File>"
}
  1. Server will continue responding with the upload_id, the current offset and the expiration date (expires).

  2. Finally, when upload is completed, a POST request is sent to the url linked to ChunkedUploadView (or any subclass). This request must include the the md5 checksum (hex). Example:

{
  "md5": "fc3ff98e8c6a0d3087d515c0473f8677"
}
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-chunky-upload-1.0.3.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

django_chunky_upload-1.0.3-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

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

Hashes for django-chunky-upload-1.0.3.tar.gz
Algorithm Hash digest
SHA256 973c8998ac470b2ca02d83254b1a47a09cdb45540eab041de8c778724a4de382
MD5 ca55012e2f8a579dcea8efeb3784b43d
BLAKE2b-256 ddda6d470b4e8e38d6a91fe718168ceb099f0a91b0e1da81e5f845b56cb82aa3

See more details on using hashes here.

File details

Details for the file django_chunky_upload-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_chunky_upload-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 604b52cfab0fe8d621c22f131e538d12f0a8ac1d1b235857b72f677a3d43aec4
MD5 3cbf70907c37b633885e79e8248b1513
BLAKE2b-256 1c9c1d6652598a0489e42197afcac19b328dd0af35d4b14fa480eee315ab439f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page