Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9079461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:50:31+00:00 2026-06-16T19:50:31+00:00

So It appears that I have stumbled across a very bizarre issue with phonegap

  • 0

So It appears that I have stumbled across a very bizarre issue with phonegap 2.2.0.

I am trying to take a picture, and send it through the filetransfer plugin, like so:

if(navigator.camera) {
        navigator.camera.getPicture(function(imageURI){
            console.log('captured image = '+imageURI);
            $('#photoConfirmation .image-preview').attr('src', imageURI);
            self.photoURI = imageURI;
            $('#photoConfirmation').show().simpledialog2({
                'mode' : 'bool',
                'prompt' : '',
                'useModal': true,
                'zindex':1001,                    
                'callbackClose': function(e){
                    $('#photoConfirmation').hide();
                }
            });
        }, 
        function(message){
            alert('Failed to get picture: ' + message);
        }, {
            sourceType:1, 
            quality: 50, 
            destinationType:1
        });
    } else {
        alert('Camera is not supported on this device.');
    }    

 var options = new FileUploadOptions();
    options.fileKey="files[]";
    options.fileName = 'image_something'.jpg';
    options.mimeType="image/jpeg";
    options.chunkedMode = false;

    var params = new Object();
    params.extraData= 'object-' + anObject.id;

    options.params = params;
    var ft = new FileTransfer();
    ft.upload(imageURI, "http://someupload.com/destination/url", function(r){alert('Finished upload!');}, function(error){console.log(error);alert('Error uploading image with code: ' +error.code)}, options);

The problem is, this shows up in the preview, but does not upload! The picture is definitely getting captured because I see it in the image preview… I could’ve sworn I did something like this before. Does anyone see anything that I am doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:50:33+00:00Added an answer on June 16, 2026 at 7:50 pm

    There is a reference implementation of the FileTransfer plugin (which uses the captured photo from a camera) on the Cordova API Documentation, which many differences in it’s implementation from yours. Reading though your code it looks like you are firing off a File Transfer before you capture the photo (and create the imageURI). Also you are using numerical constants for sourceType and destinationType. Though these are most likly not causing the problem you are experiencing, the correct forms for these is:

    destinationType: navigator.camera.DestinationType.FILE_URI,
    sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
    

    Here is an example with some small typo fixes (I’m assuming that extra ' in the fileName isn’t a part of your code) of what should be a working version:

    if (navigator.camera) {
      navigator.camera.getPicture(
    
      function (imageURI) {
        console.log('captured image = ' + imageURI);
        $('#photoConfirmation .image-preview').attr('src', imageURI);
        self.photoURI = imageURI;
        $('#photoConfirmation').show().simpledialog2({
          'mode': 'bool',
          'prompt': '',
          'useModal': true,
          'zindex': 1001,
          'callbackClose': function (e) {
            $('#photoConfirmation').hide();
            var options = new FileUploadOptions();
            options.fileKey = "files[]";
            options.fileName = 'image_something.jpg';
            options.mimeType = "image/jpeg";
            options.chunkedMode = false;
            var params = new Object();
            params.extraData = 'object - ' + anObject.id;
            options.params = params;
            var ft = new FileTransfer();
            ft.upload(imageURI, "http://someupload.com/destination/url", function (r) {
              alert('Finished upload!');
            }, function (error) {
              console.log(error);
              alert('Error uploading image with code: ' + error.code)
            }, options);
          }
        });
      },
    
      function (message) {
        alert('Failed to get picture: ' + message);
      }, {
        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
        quality: 50,
        destinationType: navigator.camera.DestinationType.FILE_URI
      });
    } else {
      alert('Camera is not supported on this device.');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying out Intel MKL and it appears that they have their own
I have been investigating transactions and it appears that they take care of themselves
Going through Project Euler trying to learn F#, I stumbled upon what appears to
It appears that we will have to build/deploy one of our new JBoss apps
I have an object that I am serializing to xml. It appears that a
Looking at the DateTimeFormatInfo documentation, it appears that all the standard formats have colons
I have a jQuery dialog that appears and loads an external page. In that
I have an activity that appears as a dialog using the following custom theme:
I have a problem that appears and disappears for mysterious reasons. A while back
In Lion, source list group items now have a Hide/Show button that appears when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.