aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/file-upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/file-upload.js')
-rw-r--r--apps/files/js/file-upload.js35
1 files changed, 11 insertions, 24 deletions
diff --git a/apps/files/js/file-upload.js b/apps/files/js/file-upload.js
index b52221ac1fc..d0dbd65eaee 100644
--- a/apps/files/js/file-upload.js
+++ b/apps/files/js/file-upload.js
@@ -42,26 +42,6 @@ function supportAjaxUploadWithProgress() {
OC.Upload = {
_uploads: [],
/**
- * cancels a single upload,
- * @deprecated because it was only used when a file currently beeing uploaded was deleted. Now they are added after
- * they have been uploaded.
- * @param {string} dir
- * @param {string} filename
- * @returns {unresolved}
- */
- cancelUpload:function(dir, filename) {
- var self = this;
- var deleted = false;
- //FIXME _selections
- jQuery.each(this._uploads, function(i, jqXHR) {
- if (selection.dir === dir && selection.uploads[filename]) {
- deleted = self.deleteSelectionUpload(selection, filename);
- return false; // end searching through selections
- }
- });
- return deleted;
- },
- /**
* deletes the jqHXR object from a data selection
* @param {object} data
*/
@@ -144,7 +124,11 @@ OC.Upload = {
*/
onReplace:function(data){
this.log('replace', null, data);
- data.data.append('resolution', 'replace');
+ if (data.data){
+ data.data.append('resolution', 'replace');
+ } else {
+ data.formData.push({name:'resolution',value:'replace'}); //hack for ie8
+ }
data.submit();
},
/**
@@ -365,7 +349,7 @@ $(document).ready(function() {
} else if (result[0].status !== 'success') {
//delete data.jqXHR;
data.textStatus = 'servererror';
- data.errorThrown = result.data.message; // error message has been translated on server
+ data.errorThrown = result[0].data.message; // error message has been translated on server
var fu = $(this).data('blueimp-fileupload') || $(this).data('fileupload');
fu._trigger('fail', e, data);
}
@@ -543,8 +527,10 @@ $(document).ready(function() {
function(result){
if (result.status == 'success') {
var date=new Date();
- FileList.addFile(name,0,date,false,hidden);
- var tr=$('tr').filterAttr('data-file',name);
+ // TODO: ideally addFile should be able to receive
+ // all attributes and set them automatically,
+ // and also auto-load the preview
+ var tr = FileList.addFile(name,0,date,false,hidden);
tr.attr('data-size',result.data.size);
tr.attr('data-mime',result.data.mime);
tr.attr('data-id', result.data.id);
@@ -553,6 +539,7 @@ $(document).ready(function() {
lazyLoadPreview(path, result.data.mime, function(previewpath){
tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
});
+ FileActions.display(tr.find('td.filename'));
} else {
OC.dialogs.alert(result.data.message, t('core', 'Error'));
}