A file manager for web applications — browse, upload, rename and delete files on your server, either as a page of its own or as the file picker of a rich text editor.
Dosiero is two halves that talk over a small JSON protocol. The client is TypeScript with no runtime dependencies and renders into an iframe or a popup window of its own. The server connector is a PHP library that exposes one or more directory trees; you write a single entry point script and it does the rest. Everything on this site runs against a real connector, so what you see is what you get.
<script> tag is enough.npm install --save @zdenekgebauer/dosiero
Or straight from a CDN, with no build step at all. The bare package URL resolves to the UMD
build, which defines a single global dosiero; the stylesheet is then fetched from
the same CDN, next to the script, so no path is named twice:
<script src="https://cdn.jsdelivr.net/npm/@zdenekgebauer/dosiero"></script>
<script src="https://unpkg.com/@zdenekgebauer/dosiero"></script>
For an ES module instead of the global, jsDelivr serves one from the same package:
<script type="module">
import {Dosiero} from "https://cdn.jsdelivr.net/npm/@zdenekgebauer/dosiero/+esm";
</script>
Pin the version in production. Those URLs follow the newest release,
so a major version would arrive unannounced — name it instead, for example
@zdenekgebauer/dosiero@1.0.0.
The server side is a separate package:
composer require zdenekgebauer/dosiero
Creating an instance only validates the configuration; open() shows the manager.
They are separate because in window mode opening has to happen inside a user gesture, or the
popup blocker steps in.
<iframe id="iframe1"></iframe>
<script type="module">
import {Dosiero} from '/dosiero/dosiero.min.mjs';
document.addEventListener('DOMContentLoaded', () => {
new Dosiero({
mode: Dosiero.MODE_IFRAME,
endpoint: window.location.origin + '/endpoint/',
iframe: document.getElementById('iframe1'),
}).open();
});
</script>
The stylesheet is found next to the script it was loaded from, so nothing has to be copied into the webroot or named in the configuration.
filebrowserBrowseUrlos × colorScheme, every combination side by sidenew Dosiero({
mode: 'iframe', // 'iframe' or 'window'
endpoint: window.location.origin + '/endpoint/',
iframe: document.getElementById('iframe1'), // required for mode 'iframe'
filesAs: 'tiles', // preferred mode 'list' or 'tiles'
// appearance
os: 'auto', // 'auto', 'win', 'mac' or 'linux'
colorScheme: 'auto', // 'auto', 'light' or 'dark'
assetsUrl: '/vendor/dosiero/', // where dist/ lives, when it cannot be derived
theme: '/some/custom.css', // replaces the shipped theme outright
stylesheets: ['/css/dosiero-corporate.css'], // loaded after the theme
styles: ':root { --dsr-icon-color: #0b5fff; }', // inserted last, so it wins
// callbacks
onSelectFile: (files) => { /* … */ },
onClose: () => { /* … */ },
// every label can be replaced; these are the defaults
translations: {
"buttonUploadAbort": "Abort",
"buttonUploadAbortAll": "Abort all",
"buttonUpload": "Upload",
"buttonNewFolder": "New folder",
"buttonCreate": "Create",
"buttonReload": "Reload",
"buttonDelete": "Delete",
"buttonRename": "Rename",
"buttonCopy": "Copy",
"buttonMove": "Move",
"buttonFilesList": "List",
"buttonFilesTiles": "Tiles",
"labelName": "Name:",
"labelSearch": "Search:",
"labelUploadMaxSize": "Maximum size:",
"labelUploadTypes": "Allowed types:",
"buttonSelectFile": "OK",
"buttonClose": "Close",
"headerNewFolder": "Create new folder",
"headerRename": "Rename",
"headerMessage": "Message",
"headerCopy": "Copy to",
"headerMove": "Move to",
"headerUpload": "Uploading",
"txtFiles": "files",
"txtReallyDelete": "Do you really want to delete?",
"txtUploadAborted": "Canceled",
"txtUploadBadType": "type not allowed",
"txtUploadTooBig": "too large"
}
}).open();