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

前端 未结 2 1084
说谎
说谎 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条回答
  • 2021-01-21 10:48

    For securinty reasons browsers do not allow, upload inputs are readonly , unless you have have custom made uplod input

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题