Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Multipart form parsing for Falcon.

Project Description

[![Build Status](](

# Parse multipart/form-data requests in Falcon

## Install

pip install falcon-multipart

## Usage

Add the `MultipartMiddleware` to your api middlewares:

from falcon_multipart.middleware import MultipartMiddleware

api = falcon.API(middleware=[MultipartMiddleware()])

This will parse any `multipart/form-data` incoming request, and put the keys
in `req._params`, including files, so you get the field as other params.

## Dealing with files

Files will be available as [`cgi.FieldStorage`](,
with following main parameters:

- `file`: act as a python file, you can call `read()` on it, and you will
retrieve content (as *bytes*)
- `filename`: the filename, if given
- `value`: the file content in *bytes*
- `type`: the content-type, or None if not specified
- `disposition`: content-disposition, or None if not specified

## Example

# Say you have a form with those fields:
# - title => a string
# - image => an image file

def on_post(req, resp, **kwargs):
title = req.get_param('title')
image = req.get_param('image')
# Read image as binary
raw =
# Retrieve filename
filename = image.filename

Release history Release notifications

This version
History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
falcon_multipart-0.2.0-py3-none-any.whl (5.2 kB) Copy SHA256 hash SHA256 Wheel 3.6 May 12, 2017
falcon-multipart-0.2.0.tar.gz (3.3 kB) Copy SHA256 hash SHA256 Source None May 12, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page