Search code examples
javascriptphpfine-uploader

Fine uploader : Initial File List not working


I am using fine uploader and I want to show a pre-uploaded image in fine uploader on page load.
I did some research and found a potential solution here:
show previously uploaded images in [FINE UPLOADER]
However, I don't know how to implement it, below is my code(what I tried so far):

var manualUploader = new qq.FineUploader({
    element: document.getElementById('fine-uploader-manual-trigger'),
    template: 'qq-template-manual-trigger',
    request: {
        endpoint: ''
    },
    thumbnails: {
        placeholders: {
            waitingPath: 'images/waiting-generic.png',
            notAvailablePath: 'images/not_available-generic.png'
        }
    },
    validation: {
           // allowedExtensions: ['jpeg', 'jpg', 'txt'],
            itemLimit: 6,
           // sizeLimit: 51200 // 50 kB = 50 * 1024 bytes
        },
        session: {
           endpoint: 'http://localhost/spacebar/img/advertisements/advertisement_0_1467805607_138.png'
        },
    autoUpload: false,
    debug: true
});

Below is my response in console

enter image description here

and also getting this [Fine Uploader 5.10.0] Problem parsing session response: JSON.parse: unexpected character at line 1 column 1 of the JSON data error in console

Please help and instruct how to implement


Solution

  • The problem is in your session.endpoint. Fine Uploader will send a GET request on startup to this endpoint, expecting a JSON response containing data about the initial file list to populate.

    If you have specified a value for the session.endpoint option, Fine Uploader will send a GET request to your endpoint on startup (and optionally when the instance is reset). The response to this request must be valid JSON. More specifically, it must be a JSON array containing Objects for each file to be fed into the uploader.

    For more details please refer to http://docs.fineuploader.com/branch/master/features/session.html.