cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject docs commit: [CB-1863] FileTransfer.abort needs a quick example
Date Tue, 15 Jan 2013 22:22:54 GMT
Updated Branches:
  refs/heads/master b8cbda41f -> cbf69f026


[CB-1863] FileTransfer.abort needs a quick example


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

Branch: refs/heads/master
Commit: cbf69f026b49c605ea0c1918a93a56026d01db8a
Parents: b8cbda4
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Jan 15 14:22:48 2013 -0800
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Jan 15 14:22:48 2013 -0800

----------------------------------------------------------------------
 .../cordova/file/filetransfer/filetransfer.md      |   32 +++++++++++++++
 .../cordova/file/filetransfer/filetransfer.md      |   31 ++++++++++++++
 .../edge/cordova/file/filetransfer/filetransfer.md |   31 ++++++++++++++
 3 files changed, 94 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cbf69f02/docs/en/2.2.0/cordova/file/filetransfer/filetransfer.md
----------------------------------------------------------------------
diff --git a/docs/en/2.2.0/cordova/file/filetransfer/filetransfer.md b/docs/en/2.2.0/cordova/file/filetransfer/filetransfer.md
index 160bb7d..8b5f733 100644
--- a/docs/en/2.2.0/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/2.2.0/cordova/file/filetransfer/filetransfer.md
@@ -228,6 +228,38 @@ __Supported Platforms__
 - Android
 - iOS
 
+__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 fail = function(error) {
+        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 ft = new FileTransfer();
+    ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
+    ft.abort(win, fail);
+    
+    
 onprogress
 --------------
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cbf69f02/docs/en/2.3.0/cordova/file/filetransfer/filetransfer.md
----------------------------------------------------------------------
diff --git a/docs/en/2.3.0/cordova/file/filetransfer/filetransfer.md b/docs/en/2.3.0/cordova/file/filetransfer/filetransfer.md
index a3294bf..91504ab 100644
--- a/docs/en/2.3.0/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/2.3.0/cordova/file/filetransfer/filetransfer.md
@@ -230,6 +230,37 @@ __Supported Platforms__
 - Android
 - iOS
 
+__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 fail = function(error) {
+        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 ft = new FileTransfer();
+    ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
+    ft.abort(win, fail);
+
 onprogress
 --------------
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/cbf69f02/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 4d97c88..109be1b 100644
--- a/docs/en/edge/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/edge/cordova/file/filetransfer/filetransfer.md
@@ -230,6 +230,37 @@ __Supported Platforms__
 - Android
 - iOS
 
+__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 fail = function(error) {
+        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 ft = new FileTransfer();
+    ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
+    ft.abort(win, fail);
+
 onprogress
 --------------
 


Mime
View raw message