Change GET request url before opening an image item
I have initialized my FileExplorer as below:
$fileExplorer = new FileExplorer('element-id');
$fileExplorer
->path($user->id . '/Files')
->ajaxAction('file-explorer-service-url-here')
->enableThumbnailCompress(true)
->width('100%')
->layout('largeIcons')
->isResponsive(true);
And it is working almost fine but with one single conflict. lets assume my page url is :
http://my-site.test/users/1/show
When I try to open an image using the context-menu, it gives me a 404 error because of the invalid get request sent from the client side.
GET http://my-site.test/users/1/1/Files/Images/male.jpg
And the correct request should be:
GET http://my-site.test/media/1/Files/Images/male.jpg
So is there any approach to change the request url before clicking the context menu "Open" menu-item without changing the FileExplorer path ?
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
MK
Muthukrishnan Kandasamy
Syncfusion Team
January 4, 2021 08:34 AM UTC
Hi Shanaka,
Thanks for contacting Syncfusion support.
We have validated your requirement in PHP File Explorer control. We can override the image source dynamically by using ajaxSettings property. We have prepared a sample application to meet your requirement, in this sample we have assigned the new image path while opening image. Please refer to the below code block.
|
<?php
$fileexplorer=new EJ\FileExplorer('default');
echo $fileexplorer
->path('FileExplorerPHP/FileBrowser/')
->ajaxAction('EJ/Services/FileExplorer')
->ajaxDataType('jsonp')
->beforeGetImage('imageLoad')
->enableThumbnailCompress(true)
->width('100%')
->isResponsive(true)
->render();
?>
function imageLoad(args){
this.setModel({
ajaxSettings: {
getImage: {
}
}
});
}
|
The attached sample application can be downloaded from the below link.
|
Description |
Link |
|
Getting started |
|
|
Dependencies |
|
|
Live demo |
|
|
API reference |
Please let us know, if you need any further assistance.
Regards,
Muthukrishnan K
Marked as answer
SP
shanaka perera
January 4, 2021 08:45 AM UTC
Hi Muthukrishnan,
Thank you for your solution. It is working fine now.
MK
Muthukrishnan Kandasamy
Syncfusion Team
January 5, 2021 04:35 AM UTC
Hi Shanaka,
Thanks for your update.
We are glad to know that given solution works. Please let us know if you need any further assistance.
Regards,
Muthukrishnan K
RL
Ryan Lim
February 5, 2021 03:48 PM UTC
Thank you everyone for contributing. It solved my problem. Keep helping each other.
KR
Keerthana Rajendran
Syncfusion Team
February 10, 2021 05:26 AM UTC
Hi Ryan,
Most Welcome. Please get back to us if you need any further assistance. We will be happy to assist you.
Regards,
Keerthana.
SIGN IN To post a reply.
- 5 Replies
- 4 Participants
- Marked answer
-
SP shanaka perera
- Jan 1, 2021 05:38 AM UTC
- Feb 10, 2021 05:26 AM UTC