0

What should i do here to get the path const [file, setFile] = useState("");

function handleUpload(e) {
     setFile(e.target.files[0]);
//what should i do here to get the path
}
 <Button variant="contained" component="label" >Upload File <input type="file" hidden  webkitdirectory onChange={(e)=>handleUpload(e)}/></Button>

1 Answers1

0

For security reasons browsers do not allow this, i.e. JavaScript in browser has no access to the File System, however using HTML5 File API, only Firefox provides a mozFullPath property, but if you try to get the value it returns an empty string:

possible of duplicate

somesh sam
  • 152
  • 2
  • 8