Skip to content

Instantly share code, notes, and snippets.

@wei-lee
Created July 22, 2011 15:10
Show Gist options
  • Select an option

  • Save wei-lee/1099641 to your computer and use it in GitHub Desktop.

Select an option

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
$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