pqina / vue-filepond

🔌 A handy FilePond adapter component for Vue
https://pqina.nl/filepond
MIT License
1.92k stars 128 forks source link

Preview of already uploaded file in vue-filepond component #204

Closed TomePale closed 3 years ago

TomePale commented 3 years ago

Hello @rikschennink , I hope you can enlighten me what I am doing wrong here with vue-filepond. 



So my problem is when I want to edit my form I cant get preview of file I uploaded earlier, strange thing is that I used all the same code for Vue 2 and it worked without problem, but on Vue 3 it doesn’t work(I am sure I’m missing something and I did install v6 for Vue 2 and newer version for Vue 3).

As you can see from screenshot my file is there when I am editing my form but not visible in Filepond component Screenshot 2021-07-07 at 23 07 53 Screenshot 2021-07-07 at 23 11 04 This is how Filepond component looks like:

<file-pond
      ref="pond"
      credits="false"
      allow-multiple="true"
      allowFileTypeValidation="false"
      allowFileSizeValidation="false"
      fileValidateTypeDetectType="false"
      allowRemove="true"
      checkValidity="false"
      instant-upload="false"
      v-bind:files="myFiles"
      :beforeRemoveFile="handleFilePondRemoveFiles"
      v-on:updatefiles="handleFilePondUpdateFiles"
      v-on:init="handleFilePondInit"
   />

So when I am editing a form (using Laravel for backend and passing a data to Vue component in blade file...) in mounted method in Vue, this code works fine with Vue 2, I can see then file which I uploaded earlier (img or pdf) but on Vue 3 not, but its actually there:

mounted() {

        if (this.isEdit) {
            for (let file in this.files) {
                let f = new File([this.files[file]], this.files[file].name);
                this.myFiles.push(f)
            }
        }

    },

I went through your docs but could not find any proper info or code example that would work for me...

Thx for help!

rikschennink commented 3 years ago

We require the issue template to be filled out on all new issues. The issue template helps us collect all the information we need to address your submission efficiently.

Your issue can be classified as an integration question or a question about specific features of FilePond we ask you kindly to submit it on Stack Overflow.

rikschennink commented 3 years ago

One thing I do see:

let f = new File([this.files[file]], this.files[file].name);

You're not setting the mime type of the file.

TomePale commented 3 years ago

It dosen't matter, if I set it still the same problem...

TomePale commented 3 years ago

Question posted on Stackoverflow -> https://stackoverflow.com/questions/68298072/preview-of-already-uploaded-file-in-vue-filepond-component