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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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