Diego Murru
Posts: 0
Joined: Fri Apr 04, 2014 2:58 pm

Progress Bar

Hi

Do you have any recommend to implement a simple progress bar when a file is uploaded from the app to an external server via the FileTranfer function?

thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Progress Bar

Hello!

Please check this post https://getsatisfaction.com/apperyio/...

You can also implement suctom spinner http://devcenter.appery.io/documentat...

Diego Murru
Posts: 0
Joined: Fri Apr 04, 2014 2:58 pm

Progress Bar

Thank you Maryna

I follow the link but something don't work.

i've insert the progress bar code in this way.

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, {duration:100});

&#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;100stili&#46;com/uploadVideo/index&#46;php", 
               function(entry) { 
               Appery( "panelName" )&#46;progressbar({ 
               value: 32 
               }); 
               },     
               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

and i've create a new javascript file with the code suggested, and paste the css code in a custom style file.

can you help me?

thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Progress Bar

Are there any errors in console?

Diego Murru
Posts: 0
Joined: Fri Apr 04, 2014 2:58 pm

Progress Bar

nothing.

this piece of code is correct?

code
ft&#46;upload(path,
"http:&#47;&#47;www&#46;100stili&#46;com/uploadVideo/index&#46;php",
function(entry) {
Appery( "panelName" )&#46;progressbar({
value: 32
});
},
/code

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Progress Bar

Hello Diego,

It doesn't seem to be correct
Please check what settings you specify for the upload method. You may find more info here:
http://docs.phonegap.com/en/3.3.0/cor...
Please read about onprogress method there too

Return to “Issues”