You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/06/22 19:30:01 UTC
[3/3] js commit: CB-668 FileTransfer upload options,
html uri encoded params
CB-668 FileTransfer upload options, html uri encoded params
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/166ca437
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/166ca437
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/166ca437
Branch: refs/heads/master
Commit: 166ca437cbd7afdeb10826bf979eeefd365ec84c
Parents: 3f5dc00
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jun 20 17:36:17 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Jun 20 17:36:17 2012 -0700
----------------------------------------------------------------------
lib/wp7/platform.js | 3 +++
lib/wp7/plugin/wp7/FileUploadOptions.js | 26 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/166ca437/lib/wp7/platform.js
----------------------------------------------------------------------
diff --git a/lib/wp7/platform.js b/lib/wp7/platform.js
index f6fe70a..5827b93 100644
--- a/lib/wp7/platform.js
+++ b/lib/wp7/platform.js
@@ -51,6 +51,9 @@ module.exports = {
path: "cordova/plugin/wp7/console"
}
+ },
+ FileUploadOptions: {
+ path: 'cordova/plugin/wp7/FileUploadOptions'
}
},
device:{
http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/166ca437/lib/wp7/plugin/wp7/FileUploadOptions.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/FileUploadOptions.js b/lib/wp7/plugin/wp7/FileUploadOptions.js
new file mode 100644
index 0000000..10ac449
--- /dev/null
+++ b/lib/wp7/plugin/wp7/FileUploadOptions.js
@@ -0,0 +1,26 @@
+/**
+ * Options to customize the HTTP request used to upload files.
+ * @constructor
+ * @param fileKey {String} Name of file request parameter.
+ * @param fileName {String} Filename to be used by the server. Defaults to image.jpg.
+ * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg.
+ * @param params {Object} Object with key: value params to send to the server.
+ */
+var FileUploadOptions = function(fileKey, fileName, mimeType, params) {
+ this.fileKey = fileKey || null;
+ this.fileName = fileName || null;
+ this.mimeType = mimeType || null;
+
+ if(params && typeof params != typeof "") {
+ var arrParams = [];
+ for(var v in params) {
+ arrParams.push(v + "=" + params[v]);
+ }
+ this.params = encodeURIComponent(arrParams.join("&"));
+ }
+ else {
+ this.params = params || null;
+ }
+};
+
+module.exports = FileUploadOptions;
\ No newline at end of file