image icon indicating copy to clipboard operation
image copied to clipboard

Prevent user from selecting the image in certain situations

Open PINHOf opened this issue 4 years ago • 0 comments

How can we prevent the user from selecting an image in certain situations?

My problem is that I succeed on preventing the upload of the image to the server but the UI is still loaded with the image selected. I don't know how to clear or avoid showing it.

See JSFiddle example

The plugin says we should return a Promise when using the function uploadByFile. What have I tried:

uploadByFile(file)
{
    alert('Error, you cannot proceed');
    
    // Does not work 
    return Promise.reject(new Error(''));
    
    // Does not work 
    return new Promise((resolve, reject) => {});
    
    // Does not work
    return false;
},

PINHOf avatar Mar 04 '22 19:03 PINHOf