Skip to content

Commit

Permalink
Fix README. Add an example.
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Feb 17, 2011
1 parent 93596b8 commit 04215ce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
22 changes: 21 additions & 1 deletion iPhone/FileUploader/README.md
Expand Up @@ -17,14 +17,34 @@ The full params are as follows:

* server URL of the server that will receive the file
* file Absolute path or uri of the file to upload
* fileKey Parameter name of the file
* params Object with key: value params to send to the server
* fileKey Parameter name of the file
* fileName Filename to send to the server. Defaults to image.jpg
* mimeType Mimetype of the uploaded file. Defaults to image/jpeg
* success Success callback. Passed the response data from the server as a string.
* fail Error callback. Passed the error message.
* progress Called on upload progress. Signature should be function(bytesUploaded, totalBytes)

Here is a simple example usage.

window.plugins.fileUploader.uploadByUri('http://example.com/upload', 'file://path/to/file.jpg', {foo: 'bar'}, 'myPhoto', 'anImage.jpg', 'image/jpeg',
function(result) {
console.log('Done: ' + result);
},
function(result) {
console.log("Error: " + result);
},
function(loaded, total) {
var percent = 100 / total * loaded;
console.log('Uploaded ' + percent);

}
);





This is under development, and the API is likely to change.


Expand Down
4 changes: 2 additions & 2 deletions iPhone/FileUploader/fileuploader.js
Expand Up @@ -14,8 +14,8 @@ var FileUploader = function() {
*
* @param server URL of the server that will receive the file
* @param file file:// uri of the file to upload
* @param fileKey Parameter name of the file
* @param params Object with key: value params to send to the server
* @param fileKey Parameter name of the file
* @param fileName Filename to send to the server. Defaults to image.jpg
* @param mimeType Mimetype of the uploaded file. Defaults to image/jpeg
* @param success Success callback. Passed the response data from the server as a string.
Expand All @@ -31,8 +31,8 @@ FileUploader.prototype.uploadByUri = function(server, file, params, fileKey, fil
*
* @param server URL of the server that will receive the file
* @param file Absolute path of the file to upload
* @param fileKey Parameter name of the file
* @param params Object with key: value params to send to the server
* @param fileKey Parameter name of the file
* @param fileName Filename to send to the server. Defaults to image.jpg
* @param mimeType Mimetype of the uploaded file. Defaults to image/jpeg
* @param success Success callback. Passed the response data from the server as a string.
Expand Down

0 comments on commit 04215ce

Please sign in to comment.