You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by he...@apache.org on 2012/06/27 22:29:48 UTC

docs commit: [CB-970] add header support docs for filetransfer upload on ios

Updated Branches:
  refs/heads/master c1be0f62c -> 87b7d3bf6


[CB-970] add header support docs for filetransfer upload on ios


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/87b7d3bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/87b7d3bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/87b7d3bf

Branch: refs/heads/master
Commit: 87b7d3bf659b683ad20adad35a6bbc912cbb819a
Parents: c1be0f6
Author: hermwong <he...@gmail.com>
Authored: Wed Jun 27 13:29:28 2012 -0700
Committer: hermwong <he...@gmail.com>
Committed: Wed Jun 27 13:29:28 2012 -0700

----------------------------------------------------------------------
 .../edge/cordova/file/filetransfer/filetransfer.md |   36 ++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/87b7d3bf/docs/en/edge/cordova/file/filetransfer/filetransfer.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/file/filetransfer/filetransfer.md b/docs/en/edge/cordova/file/filetransfer/filetransfer.md
index 72a621e..a354c04 100644
--- a/docs/en/edge/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/edge/cordova/file/filetransfer/filetransfer.md
@@ -151,6 +151,40 @@ __Full Example__
         <p>Upload File</p>
     </body>
     </html>
+    
+iOS Quirks
+----------
+
+Setting headers for FileTransfer Upload:
+
+__Quick Example__
+
+    function win(r) {
+        console.log("Code = " + r.responseCode);
+        console.log("Response = " + r.response);
+        console.log("Sent = " + r.bytesSent);
+    }
+    
+    function fail(error) {
+        alert("An error has occurred: Code = " + error.code);
+        console.log("upload error source " + error.source);
+        console.log("upload error target " + error.target);
+    }
+    
+    var uri = "http://some.server.com/upload.php";
+    
+    var options = new FileUploadOptions();
+    options.fileKey="file";
+    options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
+    options.mimeType="text/plain";
+        
+    var params = new Object();
+    params.headers={'headerParam':'headerValue'};
+    
+    options.params = params;
+    
+    var ft = new FileTransfer();
+    ft.upload(fileURI, uri, win, fail, options);    
 
 download
 --------------
@@ -179,4 +213,4 @@ __Quick Example__
             console.log("download error target " + error.target);
             console.log("upload error code" + error.code);
         }
-    );
+    );
\ No newline at end of file