2015-05-14 83 views
0

我怎么能设置<input type="file">值从动态画布? 我试图$('input[type=file]').val(canvas.toDataUrl());但没有任何工程,并抛出错误这样一个HTML帆布输入文件

Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.

回答

1

出于安全原因,它不能完成。

+0

这不会提供问题的答案。要批评或要求作者澄清,在他们的帖子下留下评论 - 你总是可以评论你自己的帖子,一旦你有足够的[声誉](http://stackoverflow.com/help/whats-reputation),你会能够[评论任何帖子](http://stackoverflow.com/help/privileges/comment)。 – Raidri

+1

怎么这样?答案是这是不可能的。 – Janar