RingoJS

Module middleware/upload

This module provides support for parsing multipart MIME messages used for file uploads.

This module behaves analogous and can be used in combination with the [params][middleware/params] middleware.

Example

var fileUpload = request.postParams['fooUpload'];
   var name = fileUpload.filename;
   // `filename` and `value` are user input and must be sanitized for security reasons.
   // Be strict about what you allow as `filename` (e.g.: only `A-Za-z\.` or simlar)
   fs.write(join(fooPath, name), fileUpload.value);

Functions

Properties


middleware (next, app)

Middleware factory to enable support for parsing file uploads.

Parameters

Function next

the wrapped middleware chain

Object app

the Stick Application object

Returns

Function

a JSGI middleware function


request.postParams

An object containing the parsed HTTP POST parameters sent with this request.