RequestResponse.uploadFiles()

Upload any incoming files from the current request and write them to your desired destination.

Files can be uploaded to any of the filesystems, binary-capable databases, or cloud-hosted blob storage services supported by Sails/Skipper (e.g. the server's hard disk, Amazon S3, Mongo GridFS, etc.). **Warning:** If you use this method to process multipart file upload requests that also include text parameters, it is very important to ensure that requesting clients send text parameters in the HTTP body _before_ they send file parameters. Otherwise the lagging text parameters _may be completely ignored_! This is a deliberate design decision in Sails/Skipper for performance and security reasons. For more information, check out the [Skipper repo on GitHub](https://github.com/balderdashy/skipper).

Usage

Hover over inputs/exits for more info.

var RequestResponse = require('machinepack-reqres');


// Upload any incoming files from the current request and write them to your desired destination.

RequestResponse.uploadFiles({

field: 'avatar',

adapter: 'skipper-s3',

uploadOpts: {},

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

field required

The name of the file parameter to check for incoming uploads.

'avatar'
adapter

The package name of the Skipper adapter to use when processing this file upload.

'skipper-s3'
uploadOpts

A dictionary of options to pass in to Skipper and the underlying adapter.

{}

Exits

error

An unexpected error occurred.

success

OK.

[ {} ]