Programmatically set name of file to upload in webpage

前端 未结 4 1080
执笔经年
执笔经年 2021-01-15 15:21

Is there a way to programmatically set the name of a file to be uploaded from a web page? I suspect that browser security restrictions make this impossible, but I\'m hoping

相关标签:
4条回答
  • 2021-01-15 16:04

    There is no way to programatically grab files from a user's computer via the browser. This would be a security violation if a website could just grab things.

    0 讨论(0)
  • 2021-01-15 16:10

    No, you cannot do this without a client-side application or special plug-in.

    Browser security doesn't allow the server to obtain information about the hard drive contents of the client.

    0 讨论(0)
  • 2021-01-15 16:17

    Yes you can (in modern browsers)...

    You can get and set the value of HTMLInputElement.files. See this answer.

    0 讨论(0)
  • 2021-01-15 16:18

    You may be able to do this using some form of browser plug-in. This is more work for you (and there are potential security implications for this beyond those found when you just have users run your app). However, it may prevent a more integrated experience for your users. I'd hesitate to eliminate the application completely, though. Browser compatibility issues are common.

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