Javascript read file without using input

前端 未结 3 792
天涯浪人
天涯浪人 2020-12-01 19:00

I have this code and for a file to be converted into base64 I have to click on Choose file and then select it. I want to hardcode the file name so it is converted to base64

3条回答
  •  爱一瞬间的悲伤
    2020-12-01 19:29

    You simply can't do what you are trying to do. Setting the path for an input element through Javascript is not possible, as a security measure. Please check here: How to resolve the C:\fakepath?

提交回复
热议问题