-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
60 lines (51 loc) · 1.83 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!DOCTYPE html>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Tea Kless <tea.kless@web.de> 2017">
<meta name="license" content="The MIT License (MIT)">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.2.0/dropzone.css">
<div class="container">
<div>
<form id="upload_widget" method="post" action="http://localhost:8080/upload" class="dropzone">
<div class="fallback">
<input name="file" type="file">
</div>
</form>
<div>
<input class="foldername" name="folder" type="text" placeholder="Upload Folder Name...">
<button type="button" class="start btn btn-primary"> upload </button>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.2.0/dropzone.js"></script>
<script type="text/javascript">
Dropzone.options.uploadWidget = {
headers: {
"Cache-Control": "",
"X-Requested-With": ""
},
paramName: 'file',
maxFileSize: 4, // MB
parallelUploads: 100,
uploadMultiple: true,
autoProcessQueue: false,
dictDefaultMessage: 'Drag an image here to upload, or click to select one',
acceptedFiles: 'image/*',
init: function() {
myDropzone = this;
var folder = document.querySelector( '.foldername' ).value;
this.on("sending", function(file, xhr, formData) {
formData.append( "folder", folder );
console.log("folder: ", folder, formData);
});
this.on('success', function( file, resp ){
console.log( file );
console.log( resp );
});
document.querySelector('.start' ).addEventListener("click", function() {
myDropzone.processQueue();
});
}
};
</script>