Nawaz Moin yaakuza
Nawaz Moin yaakuza

Reputation: 141

React select file by giving a path and not selecting a file

I want to select a file from a path that I specify in the input box automatically into my state variable, I don't want to open a select file dialog to select a file? any way thhis can be done?

Upvotes: 0

Views: 157

Answers (1)

Aitwar
Aitwar

Reputation: 903

Unfortunately (or fortunately for all users around the world), there is no way to gain direct access to user's file system using JavaScript in a browser.

You are limited to the selection dialog or drag&drop behavior. It's because of security reasons and how sandboxes used in browsers work.

Upvotes: 1

Related Questions