2014-10-01 54 views
1

我使用的科尔多瓦3.4.0从Windows转移文件8平板电脑到服务器,这里是我的代码无法上传在Windows文件8平板

 var options = new FileUploadOptions(); 
     options.fileKey  = "file";     
     options.chunkedMode = true; 
     options.headers = { Connection: "close" }; 
     options.params  = params; 
     options.fileName = "myimage.jpeg"; 
     options.httpMethod = "POST"; 

     options.mimeType = "image/jpeg"; 

     var ft = new FileTransfer(); 
     ft.upload(imagePath, encodeURI("http://192.100.200.1/Files/upload.php"), win, fail, options); 

但媒体传输开始时它显示我以下错误

Exception calling native with command :: FileTransfer :: upload ::exception=WinRTError: The parameter is incorrect.

相同的代码在Android和iOS中正常工作。

回答

0

我发现,这与windows平台的本地path,你的情况imagePath,需要像ms-appdata:///一种形式,可以通过使用

var imagePath = fileEntry.toURL() 

,而不是使用

fileEntry.toInternalURL() 
获得

返回类似cdvfile://或代替

fileEntry.fullPath 

返回类似\\path\to\file。它必须指出的是,根据科尔多瓦4.0.0当前文档,cdvfile://应该传给FileTransfer。科尔多瓦的Windows平台尚不存在,需要更新。