]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - frontend/js/app.js
Set a drop zone effect to show the correct cursor
[perso/Immae/Projets/Nodejs/Surfer.git] / frontend / js / app.js
index 8970a0f8b6c3d379fa6fba545bbcc51cfdac931d..b68b6089cf5963831350d3ad0aa24179c2a1e7d7 100644 (file)
@@ -136,7 +136,7 @@ function uploadFiles(files) {
     app.uploadStatus.percentDone = 0;
 
     asyncForEach(files, function (file, callback) {
-        var path = encode(sanitize(app.path + '/' + file.name));
+        var path = encode(sanitize(app.path + '/' + (file.webkitRelativePath || file.name)));
 
         var formData = new FormData();
         formData.append('file', file);
@@ -164,10 +164,13 @@ function uploadFiles(files) {
 }
 
 function dragOver(event) {
+    event.stopPropagation();
     event.preventDefault();
+    event.dataTransfer.dropEffect = 'copy';
 }
 
 function drop(event) {
+    event.stopPropagation();
     event.preventDefault();
     uploadFiles(event.dataTransfer.files || []);
 }