aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-07-26 16:47:05 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-07-26 16:47:05 +0200
commite1d14ab461aa81363497e914cb6864da49ace372 (patch)
tree0895467ace65657d5d0abfac8d4e7eb32decbaa8 /apps/files/js/files.js
parent6ccd4e0cfb57d258301993157cf100061546f0c4 (diff)
parentc8de77b3fddf52eeaf0f81224e9b4aa2085bcc59 (diff)
downloadnextcloud-server-e1d14ab461aa81363497e914cb6864da49ace372.tar.gz
nextcloud-server-e1d14ab461aa81363497e914cb6864da49ace372.zip
Merge branch 'master' into subadmin
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js36
1 files changed, 20 insertions, 16 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 86c5185bf72..a4e2361feeb 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -497,23 +497,27 @@ $(document).ready(function() {
localName=(localName.match(/:\/\/(.[^/]+)/)[1]).replace('www.','');
}
localName = getUniqueName(localName);
- $.post(
- OC.filePath('files','ajax','newfile.php'),
- {dir:$('#dir').val(),source:name,filename:localName},
- function(result){
- if(result.status == 'success'){
- var date=new Date();
- FileList.addFile(localName,0,date);
- var tr=$('tr').filterAttr('data-file',localName);
- tr.data('mime',result.data.mime);
- getMimeIcon(result.data.mime,function(path){
- tr.find('td.filename').attr('style','background-image:url('+path+')');
- });
- }else{
+ $('#uploadprogressbar').progressbar({value:0});
+ $('#uploadprogressbar').fadeIn();
- }
- }
- );
+ var eventSource=new OC.EventSource(OC.filePath('files','ajax','newfile.php'),{dir:$('#dir').val(),source:name,filename:localName});
+ eventSource.listen('progress',function(progress){
+ $('#uploadprogressbar').progressbar('value',progress);
+ });
+ eventSource.listen('success',function(mime){
+ $('#uploadprogressbar').fadeOut();
+ var date=new Date();
+ FileList.addFile(localName,0,date);
+ var tr=$('tr').filterAttr('data-file',localName);
+ tr.data('mime',mime);
+ getMimeIcon(mime,function(path){
+ tr.find('td.filename').attr('style','background-image:url('+path+')');
+ });
+ });
+ eventSource.listen('error',function(error){
+ $('#uploadprogressbar').fadeOut();
+ alert(error);
+ });
break;
}
var li=$(this).parent();