Search code examples
javascriptphpresponsesyncfusionfile-manager

What my route have to return for the ajax call getImageUrl for the Syncfusion FileManager


My problem is that the File Manager library of Syncfusion doesn't display the pictures.

I configured "ajaxSettings" and "getImageUrl". The ajax call is executed but I still have no picture.

I don't know what my route has to return in order to work? The SyncFusion documentation does not explain exactly what is required.

I use the JavaScript library with a PHP backend. Here is my JavaScript:

var filemanagerInstance = new ej.filemanager.FileManager({
    ajaxSettings: {
        url: 'http://localhost/index.php?page=getFilesProject&id_projet=' + idProjet,
        getImageUrl: 'http://localhost/index.php?page=getImage',
    },
});

I tried to return a HTML element, e.g.: <img src="$my_path"/>.

I also tried to return the path of the picture, but the library still doesn't show the picture.

The library sends a GET request with these params:

page: getImage path: Documents/Projets/9/ 
id: ../Documents/Projets/9/d9fwkjz-ef8e1e85-62b4-445d-8853-9815b3e5e0d5_66db087cb691e.png time: 1725975676748

Solution

  • Your PHP code should return the binary content of the image file associated with the ID / path name passed to the php script from the frontend ajax code.