A beautiful media browser modal for jQuery file uploaders. Browse, search, and reuse previously uploaded files — without re-uploading.
Beautiful thumbnail grid that adapts from 6 columns on desktop to 2 on mobile. Lazy-loaded images.
Search by filename with 300ms debounce. Filter by folder tabs. Paginated results.
Toggle between single and multiple file selection with one option.
Automatically adds a "Media Library" button to any jQuery file uploader. Zero config.
Works with PHP, Node.js, Python, Go — anything that returns JSON. Examples included.
Single JS file with CSS injected. No extra dependencies beyond jQuery + Bootstrap 5.
Click the button to open the modal and select one file.
MediaLibrary.open({
onSelect: function (files) {
console.log('Selected:', files[0].url);
}
});
Select multiple files at once. Click files to toggle selection.
MediaLibrary.open({
multiple: true,
onSelect: function (files) {
// files = [{ url, name }, { url, name }, ...]
files.forEach(f => console.log(f.url));
}
});
Open the modal with a specific folder pre-selected.
MediaLibrary.open({
folder: 'products',
onSelect: function (files) {
console.log(files[0].url);
}
});
<!-- 1. Add after jQuery + Bootstrap -->
<script src="https://cdn.jsdelivr.net/npm/jquery-media-library/dist/media-library.min.js"></script>
<script>
// 2. Set your API endpoint
MediaLibrary.defaults.apiUrl = '/api/media-list';
// 3. Open the modal
$('#btn').on('click', function () {
MediaLibrary.open({
multiple: true,
onSelect: function (files) {
console.log(files);
}
});
});
</script>