我需要使用手机间隙文件api将带有一点描述或标题的图像从android或iphone上传到远程服务器但是我不熟悉php可以任何人帮我解决这个问题给ma位代码因为我急需它
答案 0 :(得分:1)
你应该尝试使用你的phonegap应用程序:
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = imageURI;
options.mimeType = type;
var params = new Object();
params.caption = "test";
params.value1 = "param";
options.params = params;
var ft = new FileTransfer();
ft.upload(imageURI, "http:/url/fileUpload.php",function onFileTransferSuccess(e){
alert("File Success");
}, fail, options);
然后在你的PHP代码中,如(fileUpload.php):
<?php
$type = $_FILES["file"]["type"];
$name = $_FILES["file"]["name"];
// here you can get your caption value passed from phonegap File transfer.
$caption = $_POST["caption"]
?>