Saturday, August 18, 2012

Non-multipart file upload

The well-known swfupload () uses multipart/form-data to post parameters and file binary data. I could not find an option to turn off multipart to stream file content to server which doesn't support multipart/form-data content-type.

However, after some research, there are two options for non-multipart file upload.

One is jQuery-File-Upload ( which provides an option 'multipart: false' to turn off multipart upload.
Official documentation:

By default, XHR file uploads are sent as multipart/form-data.
The iframe transport is always using multipart/form-data.
If this option is set to false, the file content is streamed to the server url instead of sending a RFC 2388 multipart message for XMLHttpRequest file uploads.
Non-multipart uploads are also referred to as HTTP PUT file upload.

Note: Additional form data is ignored when the multipart option is set to false.
Non-multipart uploads (multipart: false) are broken in Safari 5.1 - see issue #700.

Type: boolean
Default: true

The other is plupload ( which also provides an option 'multipart: false' to upload file using direct binary streams.
Official documentation:

Boolean state if the files should be uploaded using mutlipart instead of direct binary streams. Doesn't work on WebKit using the HTML 5 runtime.

No comments:

Post a Comment