Commit 705b8bb9 authored by Fabian-Andree Heidemann's avatar Fabian-Andree Heidemann
Browse files

[file] fix #2278, prevent folder upload because currently HTML5 does not support folders

parent 14dc8175
......@@ -469,8 +469,14 @@ define(["jquery", "jclass"], function($, JClass) {
maxChunkSize: vispa.args.global.max_request_body_size - 500,
url: vispa.url.dynamic("ajax/fs/upload?path=" + path +
"&_workspaceId=" + self.FileBase.instance.getWorkspaceId()),
start: function() {
self.$input.val(null);
add: function (event, data) {
var file = data.files[0];
if (file.type === "") {
self.FileBase.instance.alert("Unknown filetype of file \"" + file.name + "\". If it is \
a folder, store it into an archive before uploading.");
} else {
data.submit();
}
},
submit: function(event, data) {
// create progress bar and save it in data
......@@ -500,6 +506,9 @@ define(["jquery", "jclass"], function($, JClass) {
self.$progressBarContainer.css("display", "none");
});
},
start: function() {
self.$input.val(null);
},
progress: function(event, data) {
var percentage = parseInt(data.loaded / data.total * 100, 10);
$(".progress-bar", data.$progress).attr("aria-valuenow", percentage);
......@@ -517,7 +526,8 @@ define(["jquery", "jclass"], function($, JClass) {
if (data.$progress.parents().length === 0)
vispa.messenger.info("Upload aborted", "glyphicon glyphicon-stop");
} else {
self.FileBase.instance.alert(data.jqXHR.responseJSON.message);
var errorMessage = data.jqXHR.responseJSON ? data.jqXHR.responseJSON.message : data.jqXHR.responseText;
self.FileBase.instance.alert(errorMessage);
if (data.$progress.parents().length === 0)
vispa.messenger.info("Upload failed", "glyphicon glyphicon-warning-sign");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment