How to set default value in input type file by using javascript?

前端 未结 2 1085
说谎
说谎 2021-01-21 10:22

When I want to upload file from local system to server. At that time I want to set local path in input type file field but it is not set to that value. So I\'m unable to upload

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-21 10:50

    I don't think you can access the file system from the browser without human intervention. One can hack your system if browsers allow this. This will be a potential flaw in the browser. However there is a way to solve your problem.

    You can write a simple application to fetch file from file system. You will ask the client to install the application in the machine. Now this application will interact with the browser and fetch the file.

提交回复
热议问题