how to get file path in javascript code example
Example 1: how to use javascript to get full file path
const onChange = (event) => {
const value = event.target.value;
// this will return C:\fakepath\somefile.ext
console.log(value);
const files = event.target.files;
//this will return an ARRAY of File object
console.log(files);
}
return (
<input type="file" onChange={onChange} />
)
/* Found from Stack Overflow */
Example 2: how to name a file path in document.geteleementbyid
document.getElementById("retreiveData").innerHTML = "<p>Message</p> <a href=message>" + key + "</a> <p>ok?</p>"