A recent upgrade to the latest version of Phonegap seems to have introduced an intermittent upload error issue.
Randomly it will return “error code 3”. This is from what I understand a connection issue. In the code I am outputting the progress of the upload. The error randomly occurs at different stages of the upload.
I eventually found that there is a bug report at https://issues.apache.org/jira/browse/CB-2293
Two options seemed to help prevent the issue from occurring, disable chunked mode and set the connection to close in the header.
var options = new FileUploadOptions(); options.headers = { Connection: "close" } options.chunkedMode = false; ft.upload(imgUrl, PATH, uploadSuccess, uploadFail, options);