Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
ghetto-photoshare app logic
<!DOCTYPE html>
<script src="phonegap-1.0.0.js"></script>
function uploadPhoto(imageURI) {
function win(r) {
alert('Image uploaded successfully!')
function fail(err) {
alert("Ruh roh. Image failed to upload! Errorcode: " = err.code)
var opts = new FileUploadOptions();
opts.fileKey = "file";
opts.fileName = imageURI.substr(imageURI.lastIndexOf('/')+1);
opts.mimeType = "image/jpeg";
opts.params = {};
var ft = new FileTransfer();
ft.upload(imageURI, "", win, fail, opts);
function win(photo) {
function fail(err) {
navigator.notification.alert('Uh oh!')
function snap() {
var opts = {
targetWidth: 300,
targetHeight: 300,
destinationType : Camera.DestinationType.FILE_URI
}, fail, opts)
<button onclick="snap()" style="font-size:2em; margin:0 auto 0 auto;">Capture Image</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.