如何在file upload完成后将uploadcare小部件重置为原始状态

我正在使用Uploadcare小部件在一个nodejs应用程序中上传configuration文件图像。 在Uploadcare小部件中,一旦用户完成上传单个文件,我想回到原始小部件状态,以便用户可以select另一个图像来replace之前的小部件。

widget.onUploadComplete(function(info) { // assign image to image tag $('#avatar').attr('src', info.cdnUrl); // reset the widget to user can see the the "choose image" button again. widget.value(); } 

然而,widget.value()似乎没有做任何事情,虽然这是build议上uploadcare 问题

widget.value是getter / setter方法,所以widget.value()将返回当前值。

使用widget.value(null)重置。

您可以在Uploadcare JS API 文档中find更多信息 。

ps:谢谢你的提示,我已经改进了github问题的答案。