silkimen / cordova-plugin-advanced-http

Cordova / Phonegap plugin for communicating with HTTP servers. Allows for SSL pinning!
MIT License
391 stars 313 forks source link

feat: upload file without formdata #495

Open h4ck-rOOt opened 1 year ago

h4ck-rOOt commented 1 year ago

Motivation

We want to support native file uploads without the use of form-data. Therefore it was necessary to supply more information to the "uploadFiles" command and create a new way to upload those raw files.

ToDo

Details

There is a new option 'transmitFileAs' which currently only supports "BINARY", NULL, undefined or any string except "binary". The default behavior is "FORMDATA". There is no need to change existing code.

If you want to use this new feature, you can use http.sendRequest({ method: 'upload', fileName: '<yourfile>', transmitFileAs: 'BINARY', url: '<your url>' }).