Inline Responsive File Manager
Using the
modals method, a modal window displaying the Responsive File Manager gallery can be triggered by a button. Once an image is selected, the returned value is set to the "fileselected" field.
In the data-modal-href url, "field_id" corresponds to the field that is populated when an image is selected. "fldr" is the initial subdirectory to be displayed.
<button id="btnFileManager"
class="btn btn-sm btn-outline-success btn-modal col-2"
data-modal-href="/modal/filemanager?field_id=fileselected&fldr=Test"
data-modal-title="File Manager"
data-modal-class="modal-xl">
File Manager
</button>
<input type="text" class="form-control col-8" id="fileselected" />
Example
Notes
- Responsive File Manager has not been updated for PHP 8 so we are using a fork version.
-
The following has been added to the config/config.php file to ensure Responsive File Manager is only ever accessible to logged in users:
if (!isset($_COOKIE['SID'])) { die('Access Denied'); }
-
To add a callback once an image has been selected, include a "responsive_file_manager_callback" function like:
function responsive_filemanager_callback(field_id){
var url=jQuery('#'+field_id).val();
jQuery('#'+field_id).val('/'+url);
}