-
Notifications
You must be signed in to change notification settings - Fork 251
Handle preview URL
By default RichFilemanager utilizes the "userfiles" folder to store and manage of user files, which is located inside the root folder. The application determine it automatically and able to build absolute URLs to preview, as it shares the same document root path with the application.
However there are cases when the application is unable to resolve user storage folder location and build absolute preview URLs. You can get acquainted with some of such cases at the base of PHP connector examples.
Let's list possible cases:
1. Storage folder is located inside document root folder, but the name or path was changed and differs from the default one
In this case the application is still able to build absolute URL. The only thing you have to do is specify correct path to the storage folder as it's described in the related article.
2. Storage folder is located outside document root folder of the application (another document root, another server, etc.), but accessible via HTTP
For obvious reasons the application knows nothing about setup of web server which serves your files, so it can't define absolute URL to user files automatically. However RichFilemanager still able to preview the files by reading them via connector URL instead of using absolute URL.
That means the preview URL will look similar to:
http://mydomain.com/my_project/filemanager/connectors/php/filemanager.php?mode=readfile&path=/image.jpg
Instead of absolute direct URL:
http://mydomain.com/my_project/filemanager/files/image.jpg
The good news is that you can specify the URL to access storage folder of user files via HTTP explicitly.
To do this, open your JSON configuration file and set an absolute URL to access storage folder as the previewUrl
option value,
and make sure the absolutePath
option is set to true.
For the file in example above the previewUrl
may looks as:
http://mydomain.com/my_project/filemanager/files/
Since there is no way to access files inside storage folder, it's not possible to build absolute URL. The only solution to preview files is to utilize connector URL.