The front-end local file upload generates a temporary url (the file is not uploaded to the cloud)

Upload files locally to generate a temporary url

          <input type="file" name="file" accept="image/png, image/jpeg, image/jpg" @change="change" style="margin-top: 30px"/>

You can use URL.createObjectURL to generate a temporary url from the uploaded file

    change() {
      //生成的临时url
      const url = URL.createObjectURL(document.querySelector('input[type=file]').files[0]);
      this.recognize(url);
    },

Guess you like

Origin blog.csdn.net/god_sword_/article/details/131878486