Thank you, i've solve with FileTranfer to external server ![]()
Thank you, i've solve with FileTranfer to external server ![]()
Hi. Would you be able to post your filetransfer code. Is the external server on Appery or your hosted service? I see the code example in cordova docs, but since you got it working, it would be helpful if you can post it here.
Hi
the external server is my hosted service.
this's the code
code
var captureSuccess = function(mediaFiles) {
var i, path, len;
for (i = 0, len = mediaFiles.length; i < len; i += 1) {
uploadFile(mediaFiles);
// do something interesting with the file
}
};
// capture error callback
var captureError = function(error) {
navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
};
// start video capture
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1});
// Upload files to server
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile.fullPath,
name = mediaFile.name;
Code: Select all
ft.upload(path,
"http://www.mydomain.com/uploadVideo/index.php",
function(result) {
alert('Upload success: ' + result.responseCode);
console.log(result.bytesSent + ' bytes sent');
},
function(error) {
alert('Error uploading file ' + path + ': ' + error.code);
},
{ fileName: name });
} /code
for the php part i use this code
code
<?php
print_r($FILES);
move_uploaded_file($FILES["file"]["tmp_name"], "uploads/".$_FILES["file"]["name"]);
?>
/code
ah. got it. Thank you very much.
I know that Microsoft Azure has the BLOB storage where the videos etc can be uploaded using REST services as well. Here are some links to the code: