使用查询设置输入类型文件,插入保存为 base64 的图像
Setting a input type file with query, inserting image saved as base64
我有一个 Base64 图像字符串,我需要设置输入类型文件字段的值,我无法控制服务器端或站点,因此必须这样做。
这可能吗?
FB API img 上传请求/响应
响应是一个很长的 jS 字符串,设置了一些值,它非常非常非常长,不能 post 由于 SO 的字符限制。
这似乎是将图像添加到 post:
的方式
<input type="file" class="_n _5f0v" title="Vælg en fil at overføre" multiple="1" name="composer_unpublished_photo[]" aria-label="Føj billeder til dit opslag" id="js_h">
这是 post 被 post 编辑时发生的情况,其中包含一张图片,post 似乎只引用了已预先上传的图片,在上一个请求我 posted.
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?
不,不可能 "set" FileList
对象,或 input
元素的 File
对象
An object of this type is returned by the files property of the HTML
<input>
element; this lets you access the list of files selected with
the <input type="file">
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.
我有一个 Base64 图像字符串,我需要设置输入类型文件字段的值,我无法控制服务器端或站点,因此必须这样做。
这可能吗?
FB API img 上传请求/响应
响应是一个很长的 jS 字符串,设置了一些值,它非常非常非常长,不能 post 由于 SO 的字符限制。
这似乎是将图像添加到 post:
的方式<input type="file" class="_n _5f0v" title="Vælg en fil at overføre" multiple="1" name="composer_unpublished_photo[]" aria-label="Føj billeder til dit opslag" id="js_h">
这是 post 被 post 编辑时发生的情况,其中包含一张图片,post 似乎只引用了已预先上传的图片,在上一个请求我 posted.
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?
不,不可能 "set" FileList
对象,或 input
元素的 File
对象
An object of this type is returned by the files property of the HTML
<input>
element; this lets you access the list of files selected with the<input type="file">
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.