laravel dropzone attachment preview

Solutions on MaxInterview for laravel dropzone attachment preview by the best coders in the world

showing results for - "laravel dropzone attachment preview"
Noa
27 Aug 2019
1
2 init: function () {
3      @if(isset($user) && $user->picture)
4        var file = {!! json_encode($user->picture) !!}
5            this.options.addedfile.call(this, file)
6        this.options.thumbnail.call(this, file, file.preview)
7        file.previewElement.classList.add('dz-complete')
8        $('form').append('<input type="hidden" name="picture" value="' + file.file_name + '">')
9        // NOTE: Adding the Download link
10        var preview = document.createElement('a');
11        preview.setAttribute('href',file.preview);
12        preview.setAttribute('target','_blank');
13        preview.setAttribute('class','fa fa-file');
14        preview.innerHTML = " Preview";
15        file.previewTemplate.appendChild(preview);
16        // NOTE: Adding the Download link (END)
17        this.options.maxFiles = this.options.maxFiles - 1
18      @endif
19    },
20