Apache Cordova
  1. Apache Cordova
  2. CB-74

Add ContentLength Header in Upload request

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1.0
    • Fix Version/s: 1.6.0
    • Component/s: Android
    • Labels:
      None

      Description

      Some servers require a ContentLength on POST requests.

        Issue Links

          Activity

          Hide
          Bennet Huber added a comment -

          As a workaround, I've found there's an undocumented argument you can set on the options that fixes this:

          var ft = new FileTransfer();
          //Set more stuff here...
          var opts = {};
          opts.chunkedMode = false;
          ft.upload(fileURI, serverURL, onSuccess, onFail, opts);

          This somehow magically makes Android set the content length for the POST request, I'm not entirely sure why though. Found the fix on http://www.countermarch.com/blog/index.cfm/2011/10/27/PhoneGap-FileTransfer-and-ColdFusion

          Show
          Bennet Huber added a comment - As a workaround, I've found there's an undocumented argument you can set on the options that fixes this: var ft = new FileTransfer(); //Set more stuff here... var opts = {}; opts.chunkedMode = false; ft.upload(fileURI, serverURL, onSuccess, onFail, opts); This somehow magically makes Android set the content length for the POST request, I'm not entirely sure why though. Found the fix on http://www.countermarch.com/blog/index.cfm/2011/10/27/PhoneGap-FileTransfer-and-ColdFusion
          Hide
          Filip Maj added a comment -

          Content-Length header has been a part of the BlackBerry source since the first version of the FileUpload class by Justin, over a year ago.

          See: https://github.com/callback/callback-blackberry/commit/3985e1156e5c989e52b5fe65b91424075260c05b

          Yay!

          Show
          Filip Maj added a comment - Content-Length header has been a part of the BlackBerry source since the first version of the FileUpload class by Justin, over a year ago. See: https://github.com/callback/callback-blackberry/commit/3985e1156e5c989e52b5fe65b91424075260c05b Yay!
          Hide
          Joe Bowser added a comment -

          Should be fixed on Master. Changed mode to switch between chunking and streaming

          Show
          Joe Bowser added a comment - Should be fixed on Master. Changed mode to switch between chunking and streaming
          Hide
          Joe Bowser added a comment -

          Trying to resolve issue in JIRA, JIRA seems to not want to let me do it.

          Show
          Joe Bowser added a comment - Trying to resolve issue in JIRA, JIRA seems to not want to let me do it.

            People

            • Assignee:
              Joe Bowser
              Reporter:
              Simon MacDonald
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development