-
-
Save acidwave/23174130966db58cc6fcc28d9bce38f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| <link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet"> | |
| </head> | |
| <body> | |
| <div class="h-64 border-solid border-black border-4 text-center" id="dropzone"> | |
| Drop files here | |
| </div> | |
| <form action="test.php" enctype="multipart/form-data" method="post"> | |
| <input type="file" name="files[]" id="files" multiple> | |
| <button type="submit">Send</button> | |
| </form> | |
| <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script> | |
| <script> | |
| var $dropzone = $('#dropzone'); | |
| $dropzone.on('drag dragstart dragend dragover dragenter dragleave drop', function (event) { | |
| event.preventDefault(); | |
| event.stopPropagation(); | |
| }).on('drop', function(event) { | |
| document.querySelector('#files').files = event.originalEvent.dataTransfer.files; | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment