Giới Thiệu

document.addEventListener(‘DOMContentLoaded’, function() {
const uploadArea = document.querySelector(‘.upload-area-container’);
const fileInput = document.createElement(‘input’);
fileInput.type = ‘file’;
fileInput.multiple = true;
fileInput.style.display = ‘none’;
document.body.appendChild(fileInput);

if (uploadArea) {
uploadArea.addEventListener(‘click’, () => fileInput.click());

fileInput.addEventListener(‘change’, function() {
const files = this.files;
if (files.length > 0) {
alert(‘Đang tải lên ‘ + files.length + ‘ tệp…’);
// Ở đây có thể tích hợp thêm AJAX để đẩy file vào Media Library
}
});
}
});