Folder upload
How do I make an folder upload?
This snippet demonstrates how to differentiate between the files and folders of an item that's been selected for upload.. What is a folder upload? How do you make a folder upload? This script and codes were developed by Microsoft Edge Docs on 13 August 2022, Saturday.
Folder upload - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Folder upload</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div>Use a folder picker...</div>
<input type="file" webkitdirectory>
<div id="dropzone">...or drop your folders here.</div>
<div>The path names of all the files in the drop will be logged to the F12 developer tools console.</div> <script src="js/index.js"></script>
</body>
</html>
Folder upload - Script Codes CSS Codes
#dropzone { height: 200px; border: 5px dashed; margin: 1em;
}
Folder upload - Script Codes JS Codes
var dropzone = document.getElementById("dropzone");
dropzone.addEventListener("drop", function(e) { e.stopPropagation(); e.preventDefault(); var items = event.dataTransfer.items; for (var i = 0; i < items.length; i++) { var entry = items[i].webkitGetAsEntry(); if (entry) { traverse(entry); } }
}, false);
dropzone.ondragover = function (e) { e.preventDefault()
}
function traverse(entry, path) { path = path || ""; if (entry.isFile) { // Get file entry.file(function(file) { console.log("File:", path + file.name); }); } else if (entry.isDirectory) { // Get folder contents var dirReader = entry.createReader(); dirReader.readEntries(function(entries) { for (var i = 0; i < entries.length; i++) { traverse(entries[i], path + entry.name + "/"); } }); }
}
Developer | Microsoft Edge Docs |
Username | MicrosoftEdgeDocumentation |
Uploaded | August 13, 2022 |
Rating | 3 |
Size | 2,096 Kb |
Views | 38,456 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Pointer Lock Demo | 2,554 Kb |
Move around | 4,906 Kb |
XPath API Example | 2,115 Kb |
Page Visibility API Event Logging | 2,832 Kb |
IFrame for Fullscreen Test | 2,081 Kb |
Meta Referrer Test | 1,722 Kb |
Web Speech Synthesis API | 2,632 Kb |
Fullscreen API Test3 | 2,059 Kb |
Web notifications | 2,101 Kb |
Adding the dino | 5,423 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Amazing CSS Menu with Notification Badges | Faizanasad | 2,549 Kb |
Mandelbrot Fractal | _Billy_Brown | 2,706 Kb |
Animated Donut Chart | Jplhomer | 3,808 Kb |
Birthday Party Starter | Aussieyang | 1,629 Kb |
A Pen by utcwebdev | Utcwebdev | 2,856 Kb |
Sticky div | Kaslab | 2,225 Kb |
Blog demo to use given styling | Andygirl | 2,412 Kb |
AOR site logo | Thatbram | 2,527 Kb |
Material design buttons | Fischaela | 4,381 Kb |
Jstam.com Home Page | Jstam | 10,558 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!