以编程方式将文件添加到jquery文件上传 [英] Programmatically add a file to jquery fileupload
问题描述
我使用 blueimp / jQuery-File-Upload 来允许用户在我的网站上创建查询时上传附件。
我需要扩展当前的功能以将自动生成的图像添加到队列中。我需要添加的图像是一个导出的画布,因此base64编码的字符串,即类似于
数据:image / png; base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNby
// blAAAADElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC
如何将这样的文件添加到上传队列?我卡住了,不知道从哪里开始。任何指向正确的方向的指针是非常赞赏。
不可能以编程方式添加文件对象在
你可以创建一个文件为< input type =file>
元素 FileList data URI
; Blob
或 File
;或 FormData
对象,使用 POST
将文件对象发送到服务器。
I'm using blueimp/jQuery-File-Upload to allow users to upload attachments when creating a inquiry on my site.
I need to extend the current functionality to add a auto generated image to the queue. The image I need to add is an exported canvas, thus a base64 encoded string, i.e something like
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNby // blAAAADElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC
How can I add such a file to the upload queue? I am stuck and don't know where to start. Any pointers to the right direction is much appreciated.
It is not possible to programmatically add a File
object to FileList
object at <input type="file">
element. You can create a file as data URI
; Blob
or File
; or FormData
object, use POST
to send file object to server.
这篇关于以编程方式将文件添加到jquery文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!