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 9100149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:47:44+00:00 2026-06-17T00:47:44+00:00

I’m trying to capture an image using the camera and upload it to my

  • 0

I’m trying to capture an image using the camera and upload it to my AJAX endpoint. I’ve confirmed that this endpoint can accept the file (I created a test HTML file on my desktop that sends a form with an image in it). I’m using Cordova (phonegap) 1.7.0, and am trying to get the fileTransfer() to work. Here is the link for the documentation that I followed:

http://docs.phonegap.com/en/1.0.0/phonegap_file_file.md.html#FileTransfer

The success callback triggers, but no $_FILES data is to be found on the endpoint.

I then found this article:

http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/

Which suggested using options.chunkedMode = false. Now the upload takes an age and a half, before eventually failing with an error code of 3, which I believe is FileError.ABORT_ERR.

Am I missing something?

My code from the app below:

     navigator.camera.getPicture(function(imageURI){           
        console.log('take success! uploading...');
        console.log(imageURI);
        var options = new FileUploadOptions();
        options.fileKey = 'file';
        options.fileName = 'spot_image.jpeg';
        options.mimeType = 'image/jpeg';
        var params = new Object();
        params.spot_id = 1788;
        params.param2 = 'something else';
        options.params = params;        
        options.chunkedMode = false;
        var ft = new FileTransfer();
        ft.upload(imageURI,serverURL + '/ajax.php?fname=appuploadspotimage',function(r){
            console.log('upload success!');
            console.log(r.responseCode);
            console.log(r.response);
            console.log(r.bytesSent);
        },function(error){
            console.log('upload error')
            console.log(error.code);
        },options,true);
        console.log('after upload');



    },function(message){
       console.log('fail!');
       console.log(message);
    },{ 
        quality: 50,
        destinationType: navigator.camera.DestinationType.DATA_URL,
        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
    });

serverURL is defined as the domain for my AJAX endpoint, which has been whitelisted in cordova.xml.

I’ve seen a number of questions here in SO regarding this, which varying opinions as to whether chunkedMode should be used. Anyone having this issue as well?

Am trying this on a Samsung Galaxy S, running ICS.

May the person who helps me solve this issue mysteriously inherit a beer factory.

  • 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-17T00:47:46+00:00Added an answer on June 17, 2026 at 12:47 am

    You can not use imageUri that you get from camera success callback in FileTransfer upload method, you have to first resolve uri as a filename like this:

    navigator.camera.getPicture(function(imageURI){
    
          window.resolveLocalFileSystemURI(imageUri, function(fileEntry) {
                fileEntry.file(function(fileObj) {
    
                    var fileName = fileObj.fullPath;
    
                    //now use the fileName in your method
                    //ft.upload(fileName ,serverURL + '/ajax.php?fname=appuploadspotimage'...);
    
                });
            });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to render a haml file in a javascript response like so:
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to create an if statement in PHP that prevents a single post

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.