DEV Community

loading...

Discussion on: Help me please: Auto-uploading file in an html input type="file"

Collapse
andybullet profile image
AndyBullet Author

I want to make an input button in html of file type, to upload a file. But I don't want to click the button and choose the file, I want to write the path of the file in javascript and upload it automatically.

Collapse
jordanfinners profile image
Jordan Finneran

Not sure on what you're trying to achieve with this, but you might want to check out this File System API which might work for what you're trying to do.
web.dev/file-system-access/

Collapse
jordanfinners profile image
Jordan Finneran

No you can't automatically click and do the file upload in Javascript, because it doesn't have permissions to access your files. That button handles the communication between your application running inside a browser and the file system, you never have access to this for security purposes.