Upload a file on your local drive into HTML on your local file system using the File System API

WBOY
Release: 2023-08-24 18:13:06
forward
860 people have browsed it

Upload a file on your local drive into HTML on your local file system using the File System API

To upload from local drive to the local file system, we can use −

  • Webkitdirectory attribute on − This allows the user to select a directory by the appropriate dialog box.
  • Filesystem API is a sandboxed filesystem, which allows us to store files on client’s machine.
  • File API allows us to read files. Files are accessible by element

All of the above is working fine in Google Chrome.

WebKit directory is a much better option among these. Use the following for directory −

webkitRequestFileSystem(
   window.TEMPORARY, 5 * 1024 * 1024, function(_fs) {
      fs = _fs;
   },
Err
Copy after login

上面,err和fs是−

var fs,
err = function(err) {
   throw err;
};
Copy after login

The above is the detailed content of Upload a file on your local drive into HTML on your local file system using the File System API. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template