Page 2 of 2

Transfer Captured Video to Appery Database

Posted: Mon Jul 07, 2014 10:11 am
by Diego Murru

Thank you, i've solve with FileTranfer to external server :)


Transfer Captured Video to Appery Database

Posted: Mon Jul 07, 2014 1:05 pm
by pakbull6772540

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.


Transfer Captured Video to Appery Database

Posted: Mon Jul 07, 2014 1:24 pm
by Diego Murru

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&#46;length; i < len; i += 1) {
uploadFile(mediaFiles);

&#47;&#47; do something interesting with the file
}
};
&#47;&#47; capture error callback
var captureError = function(error) {
navigator&#46;notification&#46;alert('Error code: ' + error&#46;code, null, 'Capture Error');
};
&#47;&#47; start video capture
navigator&#46;device&#46;capture&#46;captureVideo(captureSuccess, captureError, {limit:1});

&#47;&#47; Upload files to server
function uploadFile(mediaFile) {
var ft = new FileTransfer(),
path = mediaFile&#46;fullPath,
name = mediaFile&#46;name;

Code: Select all

     ft&#46;upload(path, 
               "http:&#47;&#47;www&#46;mydomain&#46;com/uploadVideo/index&#46;php", 
               function(result) { 
               alert('Upload success: ' + result&#46;responseCode); 
               console&#46;log(result&#46;bytesSent + ' bytes sent'); 
               }, 
               function(error) { 
               alert('Error uploading file ' + path + ': ' + error&#46;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/"&#46;$_FILES["file"]["name"]);
?>
/code


Transfer Captured Video to Appery Database

Posted: Mon Jul 07, 2014 1:52 pm
by pakbull6772540

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:

http://azure.microsoft.com/en-us/docu...

http://azure.microsoft.com/en-us/docu...