3

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

Dmitry Mukhin
  • 6,649
  • 3
  • 29
  • 31
G G
  • 1,614
  • 1
  • 12
  • 12

1 Answers1

4

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.

Dmitry Mukhin
  • 6,649
  • 3
  • 29
  • 31
  • thanks, it did work. However I also manage to get the same results with $('.uploadcare-widget-button-remove').click(); – G G Apr 17 '15 at 15:45