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/12 05:15:12 UTC

[jira] [Created] (CB-2414) FileUpload gets return code of 400 (Bad Request) if form fields included

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

             Summary: FileUpload gets return code of 400 (Bad Request) if form fields included
                 Key: CB-2414
                 URL: https://issues.apache.org/jira/browse/CB-2414
             Project: Apache Cordova
          Issue Type: Bug
          Components: Android
    Affects Versions: 2.4.0
         Environment: Using Cordova 2.4.0rc1 on Mac OSX with Eclipse and Android Virtual Device
            Reporter: Thomas O'Dell
            Assignee: Joe Bowser


If I use the Options field to simulate a form submission with FileUpload, I get an HTML 400 (Bad Request) response, which File Upload interprets quite misleadingly as "File Not Found".

This issue is with Cordova 2.4.0rc1, but I believe it also applies to the 2.4.0 release. I have only checked this with Android, but it may also apply to other implementations.

I use FileUpload to send a file to Amazon Web Services which needs security information and signatures in the web form. The following are my parameters to the Android upload task (<> indicate snipped data):

upload /mnt/sdcard/Android/data/<application>/cache/1360638914950.jpg to https://<region>/<amazon-bin>/
fileKey: uploads/20130212T0314Z_9f7afd7a616a5d238b21a5c9231ad74a/${filename}
fileName: 1360638914950.jpg
mimeType: image/jpeg

params: {
  "success_action_status":"201",
  "policy":<policy>,
  "AWSAccessKeyId":<access-key-id>,
  "acl":"public-read",
  "utf8":"✓",
  "signature":<signature>,
  "key":"uploads\/20130212T0314Z_9f7afd7a616a5d238b21a5c9231ad74a\/${filename}"
}
trustEveryone: false
chunkedMode: true
headers: null
objectId: 1

The first chunk is transmitted properly to the server (what the server gets, we don't know). However the response code returned by conn.getResponseCode() is 400, and the attempt to open the connection for read fails (generating the "File Not Found" error).

--
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