function multi_img_upload($upload_files_array) { foreach ($upload_files_array as $post_key => $upload_array) { if ($upload_array['error'] != 4) { $location = get_upload_file_location($post_key, $file_fields[$table_name]); $image_path = upload_img("", $upload_array, $location); $post_data[$post_key] = "/uploads/album_images/" . $image_path['urls'][0]; } } return $post_data; }
NoCSRF::check('csrf_token', $_POST, true, 60 * 10, false); $result = 'CSRF check passed. Form parsed.'; $err_trgr = false; if (isset($_FILES['data']['name']) and $_FILES['data']['name']) { $post_key_arr = array_keys($_FILES['data']['name']); foreach ($post_key_arr as $k => $post_key) { foreach ($_FILES['data'] as $files_key => $files_value) { $upload_files_array[$post_key][$files_key] = $files_value[$post_key]; } } if (isset($upload_files_array) and !empty($upload_files_array)) { foreach ($upload_files_array as $post_key => $upload_array) { if ($upload_array['error'] != 4) { $f_detail = file_name_details($upload_array['name']); if (in_array($f_detail['ext'], $allowed_exts[$post_key])) { $location = get_upload_file_location($post_key, $file_fields[$table_name]); $image_path = upload_img("", $upload_array, $location); $_POST['data'][$post_key] = $image_path['urls'][0]; } else { $er_msg = 'Selected File for <b class="text-danger">' . $post_key . '</b> Field is wrong.<br><div class="well well-sm"><b><i>Allowed File types are</i></b>: <ol>'; foreach ($allowed_exts[$post_key] as $allowed_exts_key => $allowed_exts_val) { $er_msg .= '<li>' . $allowed_exts_val . '</li>'; } $er_msg .= "</ol></div>"; $error_message[] = $er_msg; $err_trgr = true; } } } } }