Upload success then click image to replace

OK, newbie question so pls. forgive.

Uploading is ‘easy’ click, open widget, click uploaded - simple …

On upload I call the new url into an tab - simple …

Now how can I either click that image to replace it (you can by clicking the image name) - uploadcare–link uploadcare–widget__file-name but for ‘my users’ that is not/would not be clear so …

How can I either click the image to trigger a replacement upload OR change the image name text to say ‘Replace’ or any other suggestion please …

var singleWidget = uploadcare.SingleWidget(’[role=uploadcare-uploader]’);
singleWidget.onUploadComplete(function(info) {
jQuery(’#photoURL’).attr(‘src’,info.cdnUrl);
});

If have tried:

var file = singleWidget.value();
if (file) {
file.cancel();
}

but nope not doing anything …

As said suggestions please

Hi @parrott.russell,

There is no way to remove a file from storage via JS API. You can removethe preview image by clicking on it via JS, note that the image won’t be removed from storage. Also, you can open the widget by clicking on the preview in order to replace the image

jQuery(’#photoURL’).on(‘click’, singleWidget.openDialog());

If you need to remove a file from storage, you’ll need to send the DELETE request to REST API. The proper and secure way is to initiate the request from the backend, not from the frontend as REST API requests require a secret key.