0

I am working with net core and vuejs, I followed the example of several pages until I got here

I followed these steps but when I click on the button in the console the "response.data" brings me all the code from my system (typical call error I guess)

</template>
 <div class="panel-body">
  <div class="row">
   <div class="container">
    <div class="form-group">
        <label>Seleccione una imagen. <input id="file" type="file" accept=".jpg, .png" ref="file" v- 
         on:change="handleFileUpload()" /> </label></div>
<div class="form-group">
        <button class="btn btn-dark btn-block btn-xs m-b-5" @click="cargarImagen()"><i class="fas fa- 
      lg fa-fw fa-upload"></i></button>
 </div>
  </div>
   </div>
    </div>
     </div>
</template>

Config...

 export default {
name: 'cargarImagenes',
data() {
  return {
    file: null
  }
},
methods: {
  handleFileUpload() {
    this.file = this.$refs.file.files[0];
    console.log("la imagencita cargada", this.file);
  },
  cargarImagen() {
    let data = new FormData();
    data.append('file', this.file);
    this.$http.post("/Paciente/Imagen", data)
      .then(response => {
        this.imagenes = response.data;
        console.log("imagenCargada", response.data)
      })

and the error....(at least one of them)...

error in the response.data

luis
  • 49
  • 5

0 Answers0