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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:04:52+00:00 2026-06-06T00:04:52+00:00

I have tried to upload image using FileTransfer.upload in phonegap api.But I am getting

  • 0

I have tried to upload image using FileTransfer.upload in phonegap api.But I am getting the error.The error is “Connection Error” and the error code is 3.

Here is my code.
<!DOCTYPE html>
<html>
<head>
<title>Video Uploader</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="master.css" type="text/css" />
<script type="text/javascript" charset="utf-8"src="phonegap-1.1.0.js"></script>
<script src="Scripts/jQuery-1.6.1.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>

<script type="text/javascript" charset="utf-8">
 function getphoto(){
   navigator.camera.getPicture(uploadPhoto,function(message) { 
   alert('get picture failed');
   },{   quality:10,destinationType:navigator.camera.DestinationType.FILE_URI,sourceType:navigator.camera.PictureSourceType.PHOTOLIBRARY }); 
   }

     function uploadPhoto(imageURI) {   

        document.getElementById("myimg").src=imageURI;

        var options = new FileUploadOptions(); 
        options.chunkedMode  = false;
        options.fileKey="recFile"; 
        var imagefilename = imageURI; 
        options.fileName=imagefilename; 
        options.mimeType="image/jpeg"; 


        var ft = new FileTransfer(); 
        alert(imagefilename);


        ft.upload(imageURI, "http://xxxx.asmx", win, fail, options,true); 
    } 
     function win(r) { 

        alert("Response = " + r.response); 
        alert("Sent = " + r.bytesSent); 
    } 
    function fail(error) { 
     switch (error.code) { 
                case FileTransferError.FILE_NOT_FOUND_ERR: 
                    alert("Photo file not found"); 
                    break; 
                case FileTransferError.INVALID_URL_ERR: 
                    alert("Bad Photo URL"); 
                    break; 
                case FileTransferError.CONNECTION_ERR: 
                    alert("Connection error"); 
                    break; 
            } 

        alert("An error has occurred: Code = " + error.code); 
    } 
   </script>
  </head>
   <body >
   <button onclick="getphoto();">get a Photo</button>
   <button onclick="getphoto();">Upload a Photo</button>
   <img src="" id="myimg" style="border:1px solid #0f0;height:200px;width:200px;" />

   </body>
  </html>

please see that and tell me the solution.What is the concept of upload.php in phonegap api

  • 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-06T00:04:53+00:00Added an answer on June 6, 2026 at 12:04 am

    Have you tried to upload to another server? If the upload succeeds, the problem can be in your server settings. I’m having this trouble and starting to look to my nginx/passenger conf.

    EDIT:

    I solved this by increasing client_max_body_size setting on nginx (it defaults to 1MB).

    Also, it seems that your last parameter on “ft.upload” (the “true”) is meant for https requests, so you should omit that in this case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried for unload and beforeunload binding in following code, but none of
I am trying to upload the image using the webservices and Base64string. But each
I want to upload an image to my friend's account/wall using Facebook Api Through
I have given my code below. It is having a image field. I'm using
I have tried to upload +100 files to azure with Delphi. However, the calls
I have tried FBConnect for iPhone and am able to create/manage sessions and upload
Before I have tried about doing one attachment (upload) for each record of my
I have tried searching over the internet about this problem but not able to
I have tried many permutations but they all don't seems to work well. Am
I am trying to POST an image to imageshack using their API and Play

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.