Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to reset uploadcare widget to original state after the file upload is complete

I am using Uploadcare widget to upload profile images in an nodejs app. In Uploadcare widget once user is done uploading a single file, I want to go back to original widget state so the user can choose another image to replace the previous one.

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();
}

However the widget.value() doesn't seem to do anything although that is suggested on issue on uploadcare

like image 820
G G Avatar asked Dec 02 '25 01:12

G G


1 Answers

widget.value is getter/setter method, so widget.value() will just return current value.

Use widget.value(null) to reset.

You can find more in Uploadcare JS API documentation.

p.s.: thanks for the tip, I have improved an answer in github issue.

like image 109
Dmitry Mukhin Avatar answered Dec 04 '25 14:12

Dmitry Mukhin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!