Setting a input type file with query, inserting image saved as base64

前端 未结 1 1046
慢半拍i
慢半拍i 2021-01-29 03:11

I have a Base64 image string, i need to set the value of an input type file field, i have no control of the server side, or of the site, so it has to be done like this.

1条回答
  •  -上瘾入骨i
    2021-01-29 03:51

    need to set the value of an input type file field, i have no control of the server side, or of the site, so it has to be done like this.

    Is this possible?

    No, it is not possible to "set" the FileList object , or File object of an input element

    An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element.

    var file = document.getElementById('fileItem').files[0];

    Method overview

    File item(index);

    Properties

    Attribute Type Description

    length integer A read-only value indicating the number of files in the list.

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