Note that there are some explanatory texts on larger screens.

plurals
  1. POPhoneGap .wav upload from an iOS device is creating a 0k file on the server
    primarykey
    data
    text
    <p>I am attempting to record audio on an iPhone using PhoneGap, then send that audio to a server. I am using PhoneGaps Media APIs to make the recording, then the PhoneGap file transfer API to send the file to the server.</p> <p>I am able to make the recording just fine, and playing it back works perfectly. When I try to send it to the server, however, the recording shows up on the server but it says the file is 0k big.</p> <p>I've done fairly extensive searching on this issue and found others that have had this problem. For example: <a href="https://groups.google.com/forum/#!topic/phonegap/zjzSs6JVokE" rel="nofollow">https://groups.google.com/forum/#!topic/phonegap/zjzSs6JVokE</a></p> <pre><code> function win(r) { alert("Code = " + r.responseCode); alert("Response = " + r.response); alert("Sent = " + r.bytesSent); } function fail(error) { alert("An error has occurred: Code = " + error.code); console.log("upload error source " + error.source); console.log("upload error target " + error.target); } function upLoad() { var options = new FileUploadOptions(); options.fileKey="file"; options.fileName=myPath.substr(myPath.lastIndexOf('/')+1); options.mimeType="audio/wav"; var params = new Object(); var headers={'headerParam':'headerValue'}; options.headers = headers; options.chunkedMode = false; var ft = new FileTransfer(); ft.upload(encodeURI(myPath), encodeURI("http://myserver.com/upload.php"), win, fail, options); } </code></pre> <p>Here is the code on the server side:</p> <pre><code>print_r($_FILES); $new_image_name = "testFile.wav"; move_uploaded_file($_FILES["file"]["tmp_name"], "/var/www/wwwroot/recordings/".$new_image_name); </code></pre> <p>I think that this may be an issue with the fact that I am sending .wav files. When I send the file over, r.bytesSent usually shows about 200 to 400 bytes (regardless of the size of the file), so it seems like the actual content of the file just isn't being sent over.</p> <p>I have tested the above code with a simple text file and it goes through just fine, so I don't think it's a permissions or syntactical issue. I haven't tried this with image files, but I can't imagine it makes to much of a difference what I am sending.</p> <p>Has anyone done this successfully?</p>
    singulars
    1. This table or related slice is empty.
    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.
    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