Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <head>
- <title></title>
- <script src="https://code.jquery.com/jquery-2.2.4.min.js" type="text/javascript"></script>
- <script>
- $(document).ready(function () {
- $(document).on('drop', 'body', function (e) {
- e.preventDefault();
- e.stopPropagation();
- if (e.originalEvent == null || e.originalEvent == undefined) {
- var file = e.dataTransfer.files[0];
- console.log(file);
- }
- else {
- var file = e.originalEvent.dataTransfer.files[0]; // I have the file.. now what?
- console.log(file);
- }
- });
- $("body").on("dragenter dragover", function (e) {
- e.preventDefault();
- });
- });
- </script>
- </head>
- <body>
- <table id="holder">
- <tr>
- <td>
- Drop files here
- </td>
- </tr>
- <tr>
- <td>
- <ul id="fileList">
- </ul>
- </td>
- </tr>
- </table>
- <br />
- <hr />
- </body>
Add Comment
Please, Sign In to add comment