I'm attempting to build an app that uploads all data from a harddrive into an array. It's just a folder with other folders in it, my idea is to upload the names of all the folders into the array. The following is my code for doing so, the problem is I'm getting "C:\fakepath\title_t00.mkv" as the value of the input when I console log it. I understand this is a security feature that prevents JavaScript from knowing your file's local full path but I obviously can't finish the project without getting all of the data.
Is there any way to do this?
import './App.css';
import {useRef, useState, useEffect} from 'react'
function App() {
const data = useRef(null)
const [library, setLibrary] = useState([])
useEffect(() => {
console.log(data.current)
setLibrary([data.current])
}, [data])
return (
<form>
<label>
<div className='btn-three' >
Select Directory:
<input type="file" ref={data} webkitdirectory="true" onInput={(e) => {console.log(e.target.value)}}/>
</div>
</label>
</form>
);
}
export default App;