How can I show you the files already stored on server using Dropzone.js

后端 未结 9 2114
长发绾君心
长发绾君心 2020-12-22 23:39

I Don\'t understand that... call its always undefined

Create the mock file:

var mockFile = { name: \"Filename\", size: 12345 };
         


        
9条回答
  •  感动是毒
    2020-12-23 00:02

    my solution for >= 4.0, basing on "How to show files already stored on server": https://github.com/enyo/dropzone/wiki/FAQ

    maxFiles: 1,
    
    init: function () {
        this.on('maxfilesexceeded', function (file) {
            this.removeAllFiles();
            this.addFile(file);
        });
    
        var mocks = $dropzone.data('dropzone');
        for (var i = 0; i < mocks.length; i++) {
            var mock = mocks[i];
            mock.accepted = true;
    
            this.files.push(mock);
            this.emit('addedfile', mock);
            this.createThumbnailFromUrl(mock, mock.url);
            this.emit('complete', mock);
        }
    }
    

提交回复
热议问题