我在发送带有textarea值的视频时遇到问题。
我完成了视频拍摄。
将视频上传到服务器但是服务器没有从textarea接收值。
这是我要上传的代码:
[self runAction:[SKAction sequence:@[
[SKAction playSoundFileNamed:@"SoundOne.mp3" waitForCompletion:true],
[SKAction playSoundFileNamed:@"SoundOne.mp3" waitForCompletion:true],
[SKAction playSoundFileNamed:@"SoundTwo.mp3" waitForCompletion:true],
[SKAction playSoundFileNamed:@"SoundTwo.mp3" waitForCompletion:true],
[SKAction playSoundFileNamed:@"SoundThree.mp3" waitForCompletion:true],
[SKAction playSoundFileNamed:@"SoundFour.mp3" waitForCompletion:true],
]]];
这是我的PHP脚本
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
inputbox = document.getElementById('inputbox').value,
name = mediaFile.name;
ft.upload(path,
encodeURI("http://exmaple.com/api/video.php"),
function(result) {
alert('Upload success: ' + result.responseCode);
alert("Sent = " + r.bytesSent);
//make sniper disappear
var preloaderpost2 = document.getElementById('preloader-post');
preloaderpost2.style.display = 'none';
},
function(error) {
alert('Error uploading file ' + path + ': ' + error.code);
//make sniper disappear
var preloaderpost2 = document.getElementById('preloader-post');
preloaderpost2.style.display = 'none';
},
{ fileName: name}, {text: inputbox});
}
是的,有人可以帮我A.S.P ......
只想发送视频文件以及textarea值...
答案 0 :(得分:0)
你没有正确使用选项参数,它应该是这样的:(注意fileName在选项上,输入框是一个参数对象)
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
inputbox = document.getElementById('inputbox').value,
name = mediaFile.name;
var options = new FileUploadOptions();
options.fileKey = "file";
options.fileName = name;
options.mimeType = "text/plain";
var params = {};
params.inputbox = inputbox;
ft.upload(path, encodeURI("http://exmaple.com/api/video.php"), function(result) {
alert('Upload success: ' + result.responseCode);
alert("Sent = " + r.bytesSent);
//make sniper disappear
var preloaderpost2 = document.getElementById('preloader-post');
preloaderpost2.style.display = 'none';
}, function(error) {
alert('Error uploading file ' + path + ': ' + error.code);
//make sniper disappear
var preloaderpost2 = document.getElementById('preloader-post');
preloaderpost2.style.display = 'none';
}, options);
}