You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/07/18 00:01:19 UTC
docs commit: [CB-1083] Add doc issue that FileTransfer URLs should be
pre-encoded
Updated Branches:
refs/heads/master c31e6cbb5 -> bf8c3e393
[CB-1083] Add doc issue that FileTransfer URLs should be pre-encoded
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/bf8c3e39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/bf8c3e39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/bf8c3e39
Branch: refs/heads/master
Commit: bf8c3e393965827644eb902516bd80d8ca62350f
Parents: c31e6cb
Author: shazron <sh...@gmail.com>
Authored: Tue Jul 17 15:00:59 2012 -0700
Committer: shazron <sh...@gmail.com>
Committed: Tue Jul 17 15:01:14 2012 -0700
----------------------------------------------------------------------
.../edge/cordova/file/filetransfer/filetransfer.md | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/bf8c3e39/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 1966d43..867cc94 100644
--- a/docs/en/edge/cordova/file/filetransfer/filetransfer.md
+++ b/docs/en/edge/cordova/file/filetransfer/filetransfer.md
@@ -53,7 +53,7 @@ upload
__Parameters:__
- __filePath__ - Full path of the file on the device
-- __server__ - URL of the server to receive the file
+- __server__ - URL of the server to receive the file (must already be encoded using encodeURI())
- __successCallback__ - A callback that is called with a Metadata object. _(Function)_
- __errorCallback__ - A callback that is called if an error occurs retrieving the Metadata. Invoked with a FileError object. _(Function)_
- __options__ - Optional parameters such as file name and mimetype
@@ -86,7 +86,7 @@ __Quick Example__
options.params = params;
var ft = new FileTransfer();
- ft.upload(fileURI, "http://some.server.com/upload.php", win, fail, options);
+ ft.upload(fileURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
__Full Example__
@@ -129,7 +129,7 @@ __Full Example__
options.params = params;
var ft = new FileTransfer();
- ft.upload(imageURI, "http://some.server.com/upload.php", win, fail, options);
+ ft.upload(imageURI, encodeURI("http://some.server.com/upload.php"), win, fail, options);
}
function win(r) {
@@ -171,7 +171,7 @@ __Quick Example__
console.log("upload error target " + error.target);
}
- var uri = "http://some.server.com/upload.php";
+ var uri = encodeURI("http://some.server.com/upload.php");
var options = new FileUploadOptions();
options.fileKey="file";
@@ -191,7 +191,7 @@ download
__Parameters:__
-- __source__ - URL of the server to receive the file
+- __source__ - URL of the server to download the file (must already be encoded using encodeURI())
- __target__ - Full path of the file on the device
- __successCallback__ - A callback that is called with a FileEntry object. _(Function)_
- __errorCallback__ - A callback that is called if an error occurs retrieving the Metadata. Invoked with a FileError object. _(Function)_
@@ -201,9 +201,10 @@ __Quick Example__
// !! Assumes variable url contains a valid URI to a file on a server and filePath is a valid path on the device
var fileTransfer = new FileTransfer();
+ var uri = encodeURI("http://some.server.com/download.php");
fileTransfer.download(
- url,
+ uri,
filePath,
function(entry) {
console.log("download complete: " + entry.fullPath);