如何添加之前加载到DropZone.js的文件

Got a really interesting (for me) problem.

I have a dropzone.js plugin installed and now I need to put some files there... from php.

What I am trying to do:

  1. php script detects, that there are some files (in directory) that were loaded earlier (for example, few days ago). (I know the names of this files).

  2. After that, I have to pass this files to my javascript script which will add them to dropzone so user could see files that he uploaded earlier.

And all of this using Ajax.

I understand, what to do with step 1 (I can find those files). But how to pass it to js and then add to dropzone?

Or am I thinking wrong? Help me please.

Dropzone has a wiki page explaining that.

Here is how I've recently done that by getting file URLs from REST API:

$.get('http://api.to.return.files', function(data) {
    $(data.photos).each(function(i, photo) {
        var mockFile = { name: photo.name, size: photo.size, accepted: true, id: photo.id };

        myDropzone.emit("addedfile", mockFile);
        myDropzone.emit("thumbnail", mockFile, photo.url);
        myDropzone.emit("complete", mockFile);
        myDropzone.files.push(mockFile);
    });
});

If you already have your files urls in the script, use them instead of API response in my case.