validate()) { $_SESSION['error'] = implode(", ", $upload->getErrors()); header("Location: /upload"); exit; } // Move the file to the temporary directory if (!$upload->moveFile()) { $_SESSION['error'] = implode(", ", $upload->getErrors()); header("Location: /upload"); exit; } // Process the file (extract metadata for MP3/ZIP) $uploadTask = $upload->process(); $_SESSION['upload_task'] = $uploadTask; // Reload the page so the details form can be shown header("Location: /upload"); exit; } } // Step 2: Handle mix details submission elseif (isset($_POST['action']) && $_POST['action'] === 'submit_details') { if (!isset($_SESSION['upload_task'])) { $_SESSION['error'] = $locale['noUploadedFileFound']; header("Location: /upload"); exit; } $uploadTask = $_SESSION['upload_task']; $title = trim($_POST['title'] ?? ''); $description = trim($_POST['description'] ?? ''); $recorded = trim($_POST['recorded'] ?? ''); $selectedGenres = $_POST['genres'] ?? []; // array of genre IDs $dj1 = $_POST['dj1'] ?? 0; $dj2 = $_POST['dj2'] ?? 0; $dj3 = $_POST['dj3'] ?? 0; // Basic validation: title is required if (empty($title)) { $_SESSION['error'] = $locale['mixTitleRequired']; header("Location: /upload"); exit; } // Simple slugify function function slugify($text) { $text = preg_replace('~[^\pL\d]+~u', '-', $text); $text = iconv('utf-8', 'us-ascii//TRANSLIT', $text); $text = preg_replace('~[^-\w]+~', '', $text); $text = trim($text, '-'); $text = preg_replace('~-+~', '-', $text); $text = strtolower($text); return empty($text) ? 'n-a' : $text; } $slug = slugify($title); // Upload the file to the CDN $cdn = new CDN($config); $remotePath = "temp/mixes/" . uniqid() . "_" . basename($uploadTask['local_path']); $mimeType = ($uploadTask['ext'] === 'mp3') ? 'audio/mpeg' : 'application/zip'; try { $cdn->uploadFile($uploadTask['local_path'], $remotePath, $mimeType, 'private'); } catch (Exception $e) { $_SESSION['error'] = $locale['errorUploadCDN'] . $e->getMessage(); header("Location: /upload"); exit; } // Insert the mix record into the database $db = new Database($config); $stmt = $db->prepare("INSERT INTO mix (title, slug, description, cover, url, seconds, mediaplayer, dj1, dj2, dj3, pending, recorded) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)"); if ($uploadTask['file_type'] === 'mp3') { $seconds = (int)$uploadTask['metadata']['duration']; $mediaplayer = 0; } elseif ($uploadTask['file_type'] === 'zip') { $seconds = (int)$uploadTask['metadata']['total_duration']; $mediaplayer = 1; } else { $seconds = 0; $mediaplayer = 1; } $url = $remotePath; $dj1 = (int)$dj1; $dj2 = (int)$dj2; $dj3 = (int)$dj3; $cover = ""; $stmt->bind_param("sssssiiiiss", $title, $slug, $description, $cover, $url, $seconds, $mediaplayer, $dj1, $dj2, $dj3, $recorded); if (!$stmt->execute()) { $_SESSION['error'] = $locale['errorSavingMixDB']; header("Location: /upload"); exit; } $mixId = $stmt->insert_id; $stmt->close(); // Insert mix_meta entries for genres and tracklist foreach ($selectedGenres as $genreId) { $stmt = $db->prepare("INSERT INTO mix_meta (mix_id, attribute, value) VALUES (?, 'genre', ?)"); $stmt->bind_param("is", $mixId, $genreId); $stmt->execute(); $stmt->close(); } if ($uploadTask['file_type'] === 'mp3' && !empty($uploadTask['metadata']['title'])) { $tracklist = $uploadTask['metadata']['title']; $stmt = $db->prepare("INSERT INTO mix_meta (mix_id, attribute, value) VALUES (?, 'tracklist', ?)"); $stmt->bind_param("is", $mixId, $tracklist); $stmt->execute(); $stmt->close(); } elseif ($uploadTask['file_type'] === 'zip' && !empty($uploadTask['metadata']['tracklist'])) { $tracklist = implode("\n", $uploadTask['metadata']['tracklist']); $stmt = $db->prepare("INSERT INTO mix_meta (mix_id, attribute, value) VALUES (?, 'tracklist', ?)"); $stmt->bind_param("is", $mixId, $tracklist); $stmt->execute(); $stmt->close(); } // Cleanup: delete the local temporary file and clear session upload task unlink($uploadTask['local_path']); unset($_SESSION['upload_task']); $_SESSION['success'] = $locale['uploadedPendingApproval']; header("Location: profile.php"); exit; } } ?>
' . htmlspecialchars($_SESSION['error']) . '
'; unset($_SESSION['error']); } // If no file has been uploaded, show the file upload form. if (!isset($_SESSION['upload_task'])): ?>

Important Upload Information

Utah's DJs is primarily an archival project dedicated to preserving the history and culture of EDM DJs in Utah. Your uploads contribute to this historical record.

Before You Upload

  • Verify that all DJs involved are listed in our database. If a DJ is not listed, they must be added and approved before uploading.
  • Check that appropriate genres are available for your mix. New genres require approval before they can be used.
  • You can submit new DJ or genre requests through your profile settings.

Upload Process

  1. Upload your mix file (MP3 or ZIP format)
  2. Enter mix details, including title, description, and recording date
  3. Select relevant genres and DJs
  4. Submit for review

Upload Your Mix

Maximum file size: 500MB
get_all_genres(); $djsObj = new DJs($db); $allDJs = $djsObj->get_all_djs(); ?>

Enter Mix Details

File Summary

Original Name:

File Type:

Size: KB

Duration: seconds

Total Duration: seconds