Skip to main content

infrae.fileupload is a WSGI component that can be used as a middleware in order to intercept single file upload and save them on the disk. The request to the application is then replaced by a json body describing the information about the file. The original filename and mimetype sent by the browser are kept as metadata. In addition to this, it is possible to query the status of the upload and reset it with HTTP request (by appending /status to the upload URL). An API is exposed via the environ dictionnary provided the WSGI application and can be used in order to query the files.

The API provides the following methods:

create_identifier()

Create a new upload identifier that be provided while submitting the form using the X-Progress-ID parameter in the URL.

verify_identifier(identifier)

Validate a given identifier.

access_upload_bucket(identifier)

Access the given upload. An object with the following methods is returned:

get_status()

Return a dictionnary containing metadata information about the upload.

get_filename()

Return the filename of the uploaded file.

is_complete()

Return True if the upload was complete.

clear_upload()

Delete the upload.

clear_upload_bucket(identifier)

Delete the given upload.

It is possible to use the component as a standalone WSGI application and having a dedicated upload server available at a different URL.

Paster

The upload middleware (and upload application) can be used via Paster using egg:infrae.fileupload. Configuration directives are:

directory

Pool directory where to store the uploaded files. If multiple processes accross multiple servers are configured for the same URL, they should share this directory too.

max_size

Maximum allowed size for an upload in megabytes.

upload_url

URL where to upload the files. If not specified the URL specified by the wsgi environment will be used. If it is specified, the middleware won’t intercept uploads and assume this task is handled by the given URL. This is use in large installation in order to have a dedicated upload server by using the standalone application instead of the middleware. Upload URLs always ends with /upload. If it is not the case it will appended to it.

upload_key

Private key used to hash upload identifier. This enable a basic security preventing abuse of the upload middleware or application. If multiple processes and installations shares the same upload URL they should share the same upload key too.

Changes

1.0.1 (2013/10/09)

  • Support malformed requests that are not properly terminated.

1.0 (2013/10/08)

  • Initial release.

Metadata

Release files for infrae.fileupload 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for infrae.fileupload 1.0.1
File Size Uploaded
infrae.fileupload-1.0.1.tar.gz 7.9 kB Details

Release files / infrae.fileupload-1.0.1.tar.gz

Download URL infrae.fileupload-1.0.1.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0e275818f946f80ce4c540a8b78a57a32a2dcf83c5de8b94133e7a5367b60e25
BLAKE2b-256 checksum
How to use checksums
33b20c1ea74a447b0429ebefe06cb2f9797a2c93f752c0f7629f34df059a2ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page