Use an HTML file picker or drag-and-drop to let a user provide a file, then inspect its metadata or read its contents in browser JavaScript. Reading a selected file with the File API does not upload it; only separate application code that sends a network request can do that. A web page cannot use this method to silently open an arbitrary path on the visitor’s computer.
What a web page can access
The standard approach starts with a file the user selects through <input type="file"> or drops onto the page. JavaScript receives a File object for each supplied file. It can inspect the file’s name, size, MIME type, and last-modified date, and it can read the contents when the task requires them. See the W3C File API and MDN’s File API guide.
This is a user-mediated boundary, not general access to the computer’s filesystem: FileReader reads a supplied File; it does not open an arbitrary local pathname or scan a directory. The W3C File API states: “No invocations to these APIs occur silently without user intervention.”
Choose how the user supplies a file
| Approach | Best for | Boundary |
|---|---|---|
<input type="file"> with FileReader |
A conventional picker flow for one or more user-selected files | The user selects the files; the page does not gain arbitrary path access. |
Drag-and-drop with FileReader |
Pages where dropping files is a convenient way to provide input | Dropped files are still user-provided inputs. |
| File System Access API | Picker-based workflows that need richer access, including saving changes to an existing file | Permission, secure-context, user-gesture, and browser-support behavior apply; do not assume every browser supports it the same way. |
For a basic reader or metadata viewer, the file input is generally the simplest choice. Use drag-and-drop as an alternative input route, and consider the separate File System Access API only when the workflow genuinely needs its additional capabilities.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Read a selected text file
Listen for the input’s change event, check that the user selected a file, and then read it. This example displays the selected file’s contents as text and logs its basic metadata:
<input id="file" type="file">
<pre id="output"></pre>
<script>
const input = document.querySelector("#file");
const output = document.querySelector("#output");
input.addEventListener("change", () => {
const file = input.files?.[0];
if (!file) return;
console.log(file.name, file.size, file.type, file.lastModified);
const reader = new FileReader();
reader.addEventListener("load", () => {
output.textContent = String(reader.result);
});
reader.addEventListener("error", () => {
output.textContent = "Could not read the selected file.";
});
reader.readAsText(file);
});
</script>
The textContent assignment displays the result as text rather than interpreting it as HTML. The example handles one file; adding the multiple attribute to the input allows selection of more than one, which the page can process from the input’s file list.
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Choose the read method for the file’s contents
Do not treat every file as text. Choose a method based on what the application needs, then use an appropriate parser or viewer for the format. MDN documents FileReader and its available read methods.
readAsText(file)reads data as a text string, suitable for text-based files.readAsArrayBuffer(file)reads binary data into an array buffer, which is useful when a format-specific parser needs the bytes.readAsDataURL(file)returns a data URL, which can be useful for certain preview workflows.
For large reads, consider progress reporting and handle read errors. Reading bytes alone does not decode or validate a format; that is the job of the code or parser that consumes them.
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Inspect metadata without reading the contents
If the task is only to show basic metadata, you can use the selected File directly. The example above logs file.name, file.size, file.type, and file.lastModified. Read contents only if the application needs them. These properties describe the user-supplied file; they do not provide a path that lets the page reopen it later.
Reading locally is not the same as uploading
Using a file input and FileReader reads data in the browser. It does not itself send the file to a server. Uploading requires separate application logic that makes a network request; MDN’s guide to using files from web applications treats upload as a distinct flow.
Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
That distinction does not guarantee that every website keeps selected data local. An application could transmit file contents or extracted information through other code. If privacy matters, assess what the specific page does, including any network requests, rather than assuming that browser file APIs prevent an upload.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When richer filesystem access is needed
The File System Access API is separate from the basic input-and-reader flow. Chrome for Developers documents that its open-file picker requires a user gesture in a secure context and that writing to an existing file requires explicit permission. If permission to write is declined, its guidance suggests offering another save route, such as a download. See the Chrome File System Access API guide. These are Chrome’s documented conditions, not a guarantee of identical support or behavior across browsers.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Best Value
- [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
- 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
- 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
- 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
- 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
For ordinary file inspection, prefer a file input or drop target. Before relying on broader filesystem capabilities, check support and permission behavior in the browsers your application targets.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

