Show a loading message while uploading to Imgur

59 Views Asked by At

I'm using npm imgur to have my users upload an image. Is there a way to have an uploading message pop up while I'm waiting for the the image to upload? I don't think I want the whole page to be reloaded, just a pop up of sorts.

This is what the basic code looks like in my POST method:

imgur
  .uploadFile(`myFile.jpeg`)
  .then((json) => {
    console.log(json);
   }

Is there a callback for imgur.uploadFile or is there something I can do right above this code maybe with flash and/or ejs?

1

There are 1 best solutions below

0
Alpine_Shell On

I ended up just doing it in the ejs file with an onclick event on the submit button that creates an image tag linked to a loading-spin animation.