My project is requiring admins to upload video files for their content using the mediafinder which is connected to a S3 storage.
Videos are usually around 1Gigo.
The media finder is blocked and limited to 256Mb file size, and is not using the php.ini settings to handle the file upload maxFileSize.
My findings: the modules\backend\assets\vendor\dropzone\dropzone.js javascript file is hardcoded with maxFilesize: 256. This file is embedded served trough /modules/backend/assets/js/vendor-min.js
this is for OC V3.
Is this fixed in OC V4 ?
If not, I urgently need to override myself this code.
How should I go about re-building the vendor-min.js file after ovveride the dropzone.js file ?
@chris You should not modify vendor files directly (especially inside /modules/backend/assets/).
Anything inside vendor, modules, or compiled/minified bundles like vendor-min.js will be overwritten on updates.
Instead of editing the original dropzone.js, override it globally after it loads.
I need this in the backend to upload files in the mediafinder, not from the frontend through a theme.
you see my problem ?
Maybe there is an event available to hook in the mediafinder.
With Claude help, this is working for OC v3, not tested with OC v4.
If you want to increase the max file size for the media manager:
file '/plugins/acme/yourplugin/plugin.php`
public function boot()
{
\Media\Widgets\MediaManager::extend(function ($widget) {
$widget->addJs('/plugins/acme/yourplugin/assets/js/media-dropzone-override.js');
});
}
file media-dropzone-override.js
(function() {
if (typeof Dropzone === 'undefined') return;
// Method 1: Patch the Dropzone constructor
const OriginalDropzone = Dropzone;
window.Dropzone = function(element, options) {
options = options || {};
options.maxFilesize = 2048; // 2GB in MB
const instance = new OriginalDropzone(element, options);
// Force it on the instance too
if (instance.options) {
instance.options.maxFilesize = 2048;
}
return instance;
};
// Preserve everything from original
Object.setPrototypeOf(window.Dropzone, OriginalDropzone);
window.Dropzone.prototype = OriginalDropzone.prototype;
// Copy static properties
Object.keys(OriginalDropzone).forEach(key => {
if (!window.Dropzone.hasOwnProperty(key)) {
window.Dropzone[key] = OriginalDropzone[key];
}
});
// Method 2: Listen to October CMS popup events
document.addEventListener('show.oc.popup', function(event) {
// When popup is showing (media manager)
setTimeout(function() {
const dropzones = document.querySelectorAll('.dropzone');
dropzones.forEach(function(element) {
if (element.dropzone && element.dropzone.options) {
element.dropzone.options.maxFilesize = 2048;
}
});
}, 500);
});
// Method 3: Aggressive polling for new dropzone instances
let lastCount = 0;
setInterval(function() {
const dropzones = document.querySelectorAll('.dropzone');
if (dropzones.length !== lastCount) {
lastCount = dropzones.length;
dropzones.forEach(function(element) {
if (element.dropzone && element.dropzone.options && element.dropzone.options.maxFilesize !== 2048) {
console.log('Patching Dropzone maxFilesize to 2048MB');
element.dropzone.options.maxFilesize = 2048;
}
});
}
}, 300);
})();``