trigger file upload dialog using javascript/jquery

后端 未结 5 1827
梦毁少年i
梦毁少年i 2020-12-01 07:39

instead of using , is it possible to use and then script it using javascript or jquery such

5条回答
  •  不思量自难忘°
    2020-12-01 08:15

    I have the suspicion that due to security reasons you wont be able to do this. I seem to remember a while back trying to set the value attribute of a file upload element which you can't do as you could pull specific files from a users computer without their consent. I'd imagine that this would extend to programmatically changing a text box to a file upload element as you could set the value of the text field to the file you wanted to add then change it's type to a upload element and submit the form.

    It should be a simple enough thing to try although I'd think you're working within the limitations of Javascript and therefore if you can't do it in native JS you'd be unlikely to be able to use JQuery.

    Hope this makes sense,

    JLove

提交回复
热议问题