You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Thomas O'Dell (JIRA)" <ji...@apache.org> on 2013/02/13 05:19:11 UTC

[jira] [Created] (CB-2425) FileUploadOptions options structure not very clean, means you can't have a form field called 'header'

Thomas O'Dell created CB-2425:
---------------------------------

             Summary: FileUploadOptions options structure not very clean, means you can't have a form field called 'header'
                 Key: CB-2425
                 URL: https://issues.apache.org/jira/browse/CB-2425
             Project: Apache Cordova
          Issue Type: Improvement
          Components: Android, CordovaJS, iOS
    Affects Versions: 2.4.0
         Environment: Using FileUpload to post a multi-part form to the server.
            Reporter: Thomas O'Dell
            Assignee: Joe Bowser
            Priority: Minor


The current design of FileUploadOptions is that the options is an object, whose fields represent the form fields. A special option 'headers' represents the headers to be uploaded.

The format of the form fields is not compatible with JQuery and thus has to be massaged. As well, the design makes it impossible to have a form field called "headers".

I propose the following format for the Options object (25 = 2.5.0, i.e. first release to support api change):

{ 'apache-cordova-25-form-fields': [
     {name: <name>, value: <value>},
     ...
  ], // i.e. format returned by JQuery's serializeArray(formObject)

  'apache-cordova-25-header-fields': [
      {name: <name>, value: <value>},
      ...
  ],

  'apache-cordova-25-upload-options': [
      {name: <name>, value: <value>}, // e.g. force chunked mode, set throttle speed
      ...
  ],
  <old-style options and headers>
}
      

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira