CREATE TABLE `events` (
`id` bigint UNSIGNED NOT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
`date_public` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `event_categories` (
`id` bigint UNSIGNED NOT NULL,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE `event_category_joins` (
`id` bigint UNSIGNED NOT NULL,
`event_id` bigint UNSIGNED NOT NULL,
`event_category_id` bigint UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
// загрузка изображения
var file_upload = $('#file_upload');
var files_obj= {};
file_upload.on('change', function(){
if((file_upload[0].files).length !=0){
$.each(file_upload[0].files, function(i, file){
//добавляем данные в созданный объект
files_obj[file.name] = file;
});
}
let arr_files = Object.values(files_obj);
// Далее отправка через ajax
//......
//......
});