这是用于上传捕获的音频的 phonogap 代码...
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name; //audio comes here...path and name of file
var img64 = imgdata; // here comes image in base64 and will decode at php in server side
ft.upload(path,
"http://my.domain.com/upload.php",
function(result) {
console.log('Upload success: ' + result.responseCode);
console.log(result.bytesSent + ' bytes sent');
},
function(error) {
console.log('Error uploading file ' + path + ': ' + error.code);
},
{ fileName: name });
}
我想通过使用 Fileuploader 上传 base 64 中的图像数据和音频文件,并在 PHP 中存储到 url
在 PHP 中
$img = $_POST['image'];
$img = str_replace(' ', '+', $img);
$data = base64_decode($img); // FOR AUDIO how do i GET ?