function repairs_upload_form_shortcode() { ob_start(); $messages = []; $errors = []; $uploaded_attachments = []; $max_files = 12; $max_file_size_bytes = 50 * 1024 * 1024; $allowed_mime = [ 'image/jpeg','image/jpg','image/png','image/webp','image/gif', 'video/mp4','video/quicktime','video/avi','video/x-msvideo','video/mov','video/x-matroska' ]; // Handle submission if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['repair_upload_action'])) { if (!isset($_POST['repair_upload_nonce']) || !wp_verify_nonce($_POST['repair_upload_nonce'], 'repair_upload_nonce_action')) { $errors[] = 'Security check failed. Please refresh and try again.'; } else { $customer_name = sanitize_text_field($_POST['customer_name'] ?? ''); $customer_email = sanitize_email($_POST['customer_email'] ?? ''); $customer_notes = sanitize_textarea_field($_POST['customer_notes'] ?? ''); if (empty($customer_email) || !is_email($customer_email)) { $errors[] = 'Please enter a valid email address.'; } if (empty($_FILES['repair_files']['name'][0])) { $errors[] = 'Please attach at least one file.'; } if (empty($errors)) { require_once(ABSPATH . 'wp-admin/includes/file.php'); require_once(ABSPATH . 'wp-admin/includes/media.php'); require_once(ABSPATH . 'wp-admin/includes/image.php'); // Restructure file array $files = []; foreach ($_FILES['repair_files'] as $key => $values) { foreach ($values as $i => $value) { $files[$i][$key] = $value; } } foreach ($files as $file) { if ($file['error'] !== UPLOAD_ERR_OK) continue; if ($file['size'] > $max_file_size_bytes) continue; $check = wp_check_filetype_and_ext($file['tmp_name'], $file['name']); if (empty($check['type']) || !in_array($check['type'], $allowed_mime)) continue; $upload = wp_handle_upload($file, ['test_form' => false]); if (!isset($upload['error'])) { $attach_id = wp_insert_attachment([ 'post_mime_type' => $upload['type'], 'post_title' => sanitize_file_name($file['name']), 'post_status' => 'inherit' ], $upload['file']); wp_update_attachment_metadata($attach_id, wp_generate_attachment_metadata($attach_id, $upload['file'])); $uploaded_attachments[] = $attach_id; } } if ($uploaded_attachments) { $admin_email = get_option('admin_email'); $subject = 'New Repairs & Maintenance Upload'; $body = "Customer: $customer_name\nEmail: $customer_email\n\nNotes:\n$customer_notes\n\nFiles:\n"; foreach ($uploaded_attachments as $id) { $body .= wp_get_attachment_url($id) . "\n"; } wp_mail($admin_email, $subject, $body); wp_mail($customer_email, 'We received your repair request', "Thank you $customer_name,\n\nWe’ve received your files and will contact you soon.\n\n$body"); $messages[] = '✅ Files uploaded successfully. We’ll review and contact you shortly.'; } else { $errors[] = 'No valid files were uploaded.'; } } } } ?>

Repairs & Maintenance Upload

Upload photos or videos of the item(s) needing attention. We’ll assess and get back to you.

'.esc_html($m).'
'; ?> '.esc_html($e).''; ?>

Drag & drop files here or click to browse
Allowed: jpg, png, webp, gif, mp4, mov, avi, mkv (max 12 files, 50MB each)

.navbar-header { float: none; } /* .btn-group-vertical>.btn-group:after, .btn-toolbar:after, .clearfix:after, .container-fluid:after, .container:after, .dl-horizontal dd:after, .form-horizontal .form-group:after, .modal-footer:after, .modal-header:after, .nav:after, .navbar-collapse:after, .navbar-header:after, .navbar:after, .pager:after, .panel-body:after, .row:after { clear: none!important; } */ /* .nav>li>a { padding: 0!important; } .navbar-default .navbar-nav>li>a { color: #023168!important; } .navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover { color: #7CB92A!important; } */

Our Play Spaces

We’ve built playgrounds all over the UK. Pop your postcode below and find some near you.

Categories:
SIMPLE SIDE TAB