Spaces:
BG5
/
Sleeping

BG5 commited on
Commit
d94c431
·
verified ·
1 Parent(s): fcb0a2a

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +16 -4
templates/index.html CHANGED
@@ -3,6 +3,8 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <title>Shell and File Manager</title>
 
 
6
  <style>
7
  body {
8
  font-family: Arial, sans-serif;
@@ -26,10 +28,7 @@
26
  <button onclick="sendInput()">Send</button>
27
 
28
  <h1>File Upload</h1>
29
- <form action="/upload" method="post" enctype="multipart/form-data">
30
- <input type="file" name="file" />
31
- <input type="submit" value="Upload" />
32
- </form>
33
 
34
  <h1>File Manager</h1>
35
  <p><a href="/files">Go to File Manager</a></p>
@@ -47,6 +46,19 @@
47
  socket.emit('input', input);
48
  document.getElementById('input').value = '';
49
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </script>
51
  </body>
52
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <title>Shell and File Manager</title>
6
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/basic.css" />
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/dropzone.js"></script>
8
  <style>
9
  body {
10
  font-family: Arial, sans-serif;
 
28
  <button onclick="sendInput()">Send</button>
29
 
30
  <h1>File Upload</h1>
31
+ <form action="/upload" class="dropzone" id="my-dropzone"></form>
 
 
 
32
 
33
  <h1>File Manager</h1>
34
  <p><a href="/files">Go to File Manager</a></p>
 
46
  socket.emit('input', input);
47
  document.getElementById('input').value = '';
48
  }
49
+
50
+ // Dropzone configuration
51
+ Dropzone.options.myDropzone = {
52
+ paramName: "file", // The name that will be used to transfer the file
53
+ maxFilesize: 3, // MB
54
+ acceptedFiles: "image/*,application/pdf,.zip,.tar,.gz,.txt,.csv,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.mp4,.mp3,.avi,.mov,.mkv,.jpg,.jpeg,.png,.gif", // Acceptable file types
55
+ success: function(file, response) {
56
+ console.log("File uploaded successfully:", response);
57
+ },
58
+ error: function(file, response) {
59
+ console.error("Error uploading file:", response);
60
+ }
61
+ };
62
  </script>
63
  </body>
64
  </html>