0

I am trying to create a drag and drop image uploader. However, I have found that when receiving the local file path, the browser reads something along the lines of C:\fakepath\image.jpg.

I assume this is a security feature for the browser.

Is there a more secure way that I should be approaching this? If not, What is the work around?

Here is the code I am working with.

Script

handlePhotoChange = e => {
    const photo = e.target.value;
    let file = new File([""], photo);
}

HTML

<input type="file"
    name="photo"
    id="photo"
    accept="image/*"
    onChange={this.handlePhotoChange}
    className="create-content__form--upload" 
/>
Jordan Hensley
  • 420
  • 7
  • 18

0 Answers0