Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap File Transfer Error (code: 3, http_status: 404) on iPhone
    primarykey
    data
    text
    <p>I am trying to create an iOS app using PhoneGap that will allow a user to upload photos to a web server. Here is my code.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Capture Photo&lt;/title&gt; &lt;script type="text/javascript" charset="utf-8" src="cordova-1.9.0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf-8"&gt; // Wait for PhoneGap to load document.addEventListener("deviceready", onDeviceReady, false); // PhoneGap is ready function onDeviceReady() { // Do cool things here... } function getImage() { // Retrieve image file location from specified source navigator.camera.getPicture(uploadPhoto, function(message) { alert('get picture failed'); },{ quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY } ); } function uploadPhoto(imageURI) { var options = new FileUploadOptions(); options.fileKey="recFile"; options.fileName=imageURI.substr(imageURI.lastIndexOf('/')+1); options.mimeType="image/jpeg"; var params = new Object(); params.value1 = "test"; params.value2 = "param"; options.params = params; var ft = new FileTransfer(); ft.upload(imageURI, "http://someWebSite.com/Testing/SaveImage.asmx/SaveImage", win, fail, options, true); } function win(r) { console.log("Code = " + r.responseCode); console.log("Response = " + r.response); console.log("Sent = " + r.bytesSent); } function fail(error) { alert("An error has occurred: Code = " + error.code); alert("source = " + error.source); alert("http_status = " + error.http_status); console.log("upload error source " + error.source); console.log("upload error target " + error.target); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;button onclick="getImage();"&gt;Upload a Photo&lt;/button&gt; &lt;/body&gt; </code></pre> <p></p> <p>Is anything wrong with my index.html file, or is the problem with the ASMX file?</p> <p>Whenever I try to test this out on a 4th generation iPod Touch, I get the following error message:</p> <pre><code>2012-07-09 16:24:03.257 Test1[916:707] File Transfer Finished with response code 404 2012-07-09 16:24:03.260 Test1[916:707] FileTransferError { code = 3; "http_status" = 404; source = "http://someWebSite.com/Testing/SaveImage.asmx/SaveImage"; target = "file://localhost/var/mobile/Applications/5DD01E68-02F7-410B-996A- 2D70BF1A61D3/tmp/cdv_photo_046.jpg";} 2012-07-09 16:24:07.137 Test1[916:707] ERROR: Plugin 'Debug Console' not found, or is not a CDVPlugin. Check your plugin mapping in Cordova.plist. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload