1

我在将照片上传到由相机拍摄的服务器时遇到问题。我曾尝试使用 Mosync 站点中的代码,但它不起作用。

In the sample code below, 
my app always return "Could not upload photo - error: 3"



app.uploadPhoto = function(fileURL)
{
    var options = new FileUploadOptions();
    options.fileKey = "file";
    options.fileName = fileURL.substr(fileURL.lastIndexOf('/') + 1);
    options.mimeType = app.getMimeType(options.fileName);
    options.params = null;

    var transfer = new FileTransfer();

    transfer.upload(
        fileURL,
        "http://dev.mosync.com/mobilelua/PhotoGallery/upload.php",
        function(result)
        {
            alert("Photo uploaded");
        },
        function(error)
        {
            alert("Could not upload photo - error: " + error.code);
        },
        options);
};
4

0 回答 0