Created
July 22, 2011 15:10
-
-
Save wei-lee/1099641 to your computer and use it in GitHub Desktop.
An example to demonstrate how to upload a photo on device to a server using $fh.cam and $fh.file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $fh.cam({ | |
| act: 'picture', | |
| source: 'photo', | |
| uri: true | |
| }, function (res) { | |
| if (res.uri) { | |
| $('#result').html('<p>' + res.uri + '</p>'); | |
| var img = new Image(); | |
| img.src = res.uri; | |
| $('#result').css('width', '100%').css('height', '90%').append(img); | |
| $fh.file({ | |
| act: 'upload', | |
| filepath: res.uri, | |
| server: 'http://example.com/upload' | |
| }, function (res) { | |
| alert("Response is " + res.res + ". Sent data : " + res.size); | |
| }, function (err) { | |
| alert("Error " + err); | |
| }); | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment