PHP前端开发

使用文件系统API将本地驱动器上的文件上传到本地文件系统的HTML中

百变鹏仔 3个月前 (09-22) #HTML
文章标签 文件系统

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

上面,err和fs是−

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