1

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

Community
  • 1
  • 1
Mr. Tomar
  • 355
  • 3
  • 5
  • 22

1 Answers1

1

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.

Ismail RBOUH
  • 10,292
  • 2
  • 24
  • 36
  • Thanks for reply, can u explain me please, what we give in endpoint – Mr. Tomar Jul 16 '16 at 11:53
  • In your `session.endpoint` you must give a server URL that will return a valid JSON, about the structure of the response please check out the link in the answer. – Ismail RBOUH Jul 16 '16 at 11:55
  • ok, specfic url where i return the json of all images like ajax – Mr. Tomar Jul 16 '16 at 11:57
  • Hi, I am only saving image name in database, any thing else i required when using the initial file like uuid etc – Mr. Tomar Jul 16 '16 at 12:07
  • Yes, I think you need a Unique ID to identify your images! – Ismail RBOUH Jul 16 '16 at 12:10
  • @Tarzan your questions are answered in the documentation, which IsmailRBOUH has already linked to. Please read the documentation and look carefully at this answer before asking any further questions. – Ray Nicholus Jul 16 '16 at 12:16