0

Hello I was creating an upload Image but I have incounter an issue on preview image I have seen this solution and tried to replicate the File is selected and Blob URL is seen but I am having an issue on the URL and update Here is the link for the article. Also if posible to change the upload to target only Image files.

Seen solution for Upload

HTML code

  <input type="file" @change="uploadImageChange"/>
          <div class="dashboard-Image-modal__previewUploadImage">
              <img if="imageSelectedUrl" :src="imageSelectedUrl"/>
          </div>

Method

data(){
return {
   imageSelectedUrl:null
};
    },

methods:{
uploadImageChange(e){
      const file = e.target.files[0];
      this.imageSelectedUrl = URL.createObjectURL(file);
    }
}
pine ching
  • 15
  • 6

1 Answers1

0

I think i found the problem, you write:

data(){
   return {
       imageSelectedUrl:null
   },

you missed }. Try to write:

data () {
        return {
            imageSelectedUrl: null
        }
    },
El-Hani
  • 103
  • 6