You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/07/30 15:51:01 UTC

docs commit: [CB-1863] Fix filetransfer.abort() example having callbacks.

Updated Branches:
  refs/heads/master dfe7d6ce7 -> 49ff00ab7


[CB-1863] Fix filetransfer.abort() example having callbacks.


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

Branch: refs/heads/master
Commit: 49ff00ab75e9982281851329bc86f213ed78fe00
Parents: dfe7d6c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jul 30 09:50:35 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Jul 30 09:50:35 2013 -0400

----------------------------------------------------------------------
 .../cordova/file/filetransfer/filetransfer.md   | 27 ++++++++------------
 1 file changed, 10 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/49ff00ab/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 28ecdd6..7db3932 100644
--- a/docs/en/edge/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/edge/cordova/file/filetransfer/filetransfer.md
@@ -263,32 +263,25 @@ __Quick Example__
 
     // !! Assumes variable fileURI contains a valid URI to a text file on the device
 
-          var win = function(r) {
-        console.log("Code = " + r.responseCode);
-        console.log("Response = " + r.response);
-        console.log("Sent = " + r.bytesSent);
-        }
+    var win = function(r) {
+        console.log("Should not be called.");
+    }
 
     var fail = function(error) {
+        // error.code == FileTransferError.ABORT_ERR
         alert("An error has occurred: Code = " + error.code);
         console.log("upload error source " + error.source);
         console.log("upload error target " + error.target);
     }
 
-        var options = new FileUploadOptions();
-        options.fileKey="file";
-        options.fileName=fileURI.substr(fileURI.lastIndexOf('/')+1);
-        options.mimeType="text/plain";
-
-    var params = {};
-        params.value1 = "test";
-        params.value2 = "param";
-
-        options.params = params;
+    var options = new FileUploadOptions();
+    options.fileKey="file";
+    options.fileName="myphoto.jpg";
+    options.mimeType="image/jpeg";
 
-        var ft = new FileTransfer();
+    var ft = new FileTransfer();
     ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
-    ft.abort(win, fail);
+    ft.abort();
 
 onprogress
 --------------