control the working directory for <input type=“file”>?

前端 未结 6 1528
梦谈多话
梦谈多话 2020-11-29 11:11

Full story: I am working on a project for my company that requires users at each of our locations to upload reports generated by a third party software. All reports generate

6条回答
  •  -上瘾入骨i
    2020-11-29 11:40

    You cannot control the contents of a file input using JavaScript for security reasons. Otherwise, you could create a hidden form with a file input field, set it to a path, and submit the form with JavaScript in order to upload the file to your server without the user knowledge.

    Unfortunately, I'm not aware of a way to set the default path for the file selector. If there is one, I'm sure it will be browser-specific and can only be used by setting some option in the client side, not through HTML or JavaScript.

提交回复
热议问题