Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
elFinder standalonepopup in a new browser window (not modal, colorbox etc.)
<!-- main.html (html input and js for open new window with elFinder for select file) -->
<input type="text" class="form-control" value="" id="idOfInput" onfocus="return openElFinder(event, 'idOfInput');"/>
$( document ).ready(function() {
window.input_id = '';
window.openElFinder = function (event, input_id) {
window.single = true;
window.old = false;
window.input_id = input_id;'/elfinder/popup?input_id='+input_id, '_blank', 'menubar=no,status=no,toolbar=no,scrollbars=yes,height=500,width=1000');
return false;
// function to update the file selected by elfinder
window.processSelectedFile = function (filePath, requestingField) {
$('#' + requestingField).val(filePath).trigger('change');
<!-- standalonepopup.html (on url /elfinder/popup?input_id=...) -->
<!DOCTYPE html>
<html lang="it">
<meta charset="utf-8">
<!-- jQuery and jQuery UI (REQUIRED) -->
<link rel="stylesheet" type="text/css" href="//">
<script src="//"></script>
<script src="//"></script>
<!-- elFinder CSS (REQUIRED) -->
<link rel="stylesheet" type="text/css" href="/elfinder/css/elfinder.min.css">
<link rel="stylesheet" type="text/css" href="/elfinder/css/theme.css">
<!-- elFinder JS (REQUIRED) -->
<script src="/elfinder/js/elfinder.min.js"></script>
<!-- elFinder translation (OPTIONAL) -->
<script src="/elfinder/js/i18n/"></script>
<!-- Include jQuery, jQuery UI, elFinder (REQUIRED) -->
<script type="text/javascript">
$().ready(function () {
var elf = $('#elfinder').elfinder({
// set your elFinder options here
lang: 'it', // locale
url: '/elfinder....connector.php', // connector URL
soundPath: '/elfinder/sounds',
dialog: {width: 900, modal: true, title: 'Select a file'},
resizable: false,
commandsOptions: {
getfile: {
oncomplete: 'destroy'
getFileCallback: function (file, elf) {
// the magic is here, use function from "main.html" for update input value
window.parent.opener.processSelectedFile(file.path, '{{ $input_id }}');
// toolbar configuration
uiOptions : {
// toolbar configuration
toolbar : [
['home', 'back', 'forward', 'up', 'reload'],
['mkdir', 'mkfile', 'upload'],
['open', 'download', 'getfile'],
['undo', 'redo'],
['copy', 'cut', 'paste', 'rm', 'empty'],
['duplicate', 'rename', 'edit', 'resize', 'chmod'],
['selectall', 'selectnone', 'selectinvert'],
['quicklook', 'info'],
['extract', 'archive'],
// ['search'],
['view', 'sort'],
['help'], //'preference',
// toolbar extra options
toolbarExtra : {
// also displays the text label on the button (true / false)
displayTextLabel: false,
// Exclude `displayTextLabel` setting UA type
labelExcludeUA: ['Mobile'],
// auto hide on initial open
autoHideUA: ['Mobile'],
// Initial setting value of hide button in toolbar setting
defaultHides: [],
// show Preference button ('none', 'auto', 'always')
// If you do not include 'preference' in the context menu you should specify 'auto' or 'always'
showPreferenceButton: 'none'
height : '100%',
<!-- Element where elFinder will be created (REQUIRED) -->
<div id="elfinder"></div>

This comment has been minimized.

Copy link
Owner Author

@arturmamedov arturmamedov commented Jul 24, 2018

The trick is to prototype/add functions to window object and after use it from the new opened popup window in the elFinder fallback after selection getFileCallback

screenshot 2018-07-24 12 28 25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.