The path for media_upload is not set in your config.ini

"); $media_upload = getcwd() . "/" . $config["media_upload"] . "/"; ?>
Select images to upload:
"; // Configure upload directory and allowed file types $upload_dir = $media_upload.DIRECTORY_SEPARATOR; $allowed_types = array('jpg', 'png', 'jpeg', 'gif'); // Define maxsize for files i.e 2MB $maxsize = 10 * 1024 * 1024; // Checks if user sent an empty form if(!empty(array_filter($_FILES['files']['name']))) { // Loop through each file in files[] array foreach ($_FILES['files']['tmp_name'] as $key => $value) { $file_tmpname = $_FILES['files']['tmp_name'][$key]; $file_name = $_FILES['files']['name'][$key]; $file_size = $_FILES['files']['size'][$key]; $file_ext = pathinfo($file_name, PATHINFO_EXTENSION); // Apped date to filename //$file_name = date('Y-m-d_').$file_name; // Replace spaces with dashes and set all lower case $file_name = str_replace(' ', '-', strtolower($file_name)); // Set upload file path $file_path = $upload_dir.$file_name; // Check file type is allowed or not if(in_array(strtolower($file_ext), $allowed_types)) { // Verify file size - 2MB max if ($file_size > $maxsize) $msg .= "Error: File size is larger than the allowed limit.
"; // If file with name already exists then append time in // front of name of the file to avoid overwriting of file if(file_exists($file_path)) { $msg .= "Error uploading {$file_name} - File already exists!
"; // $file_path = $upload_dir.date('Y-m-d_').$file_name; // if( move_uploaded_file($file_tmpname, $file_path)) { // $msg .= "{$file_name} successfully uploaded
"; // } // else { // $msg .= "Error uploading {$file_name} - File already exists!
"; // } } else { if(move_uploaded_file($file_tmpname, $file_path)) { //$full_url = "http://{$_SERVER['HTTP_HOST']}/twtxt/".$file_name; $public_file = $public_media.basename($file_path); /* $msg .= ''; $msg .= ''; //$file = str_replace('../', $base_url, $file); $msg .= ''; $msg .= '
'; $msg .= ''; $msg .= '![]('.$public_file.')
'; */ $msg .= "{$file_name} successfully uploaded
"; //$msg .= ""; //$msg .= "![]({$full_url})
"; //$msg .= ""; } else { $msg .= "Error uploading {$file_name}
"; } } } else { // If file extension not valid //$msg .= '

'; $msg .= "Error uploading {$file_name} for unknown reason"; $msg .= "({$file_ext} file type is not allowed)
"; //$msg .= '

'; } } } else { // If no files selected $msg .= "No files selected.
"; } $msg .= "

"; $_SESSION["message"] = $msg; header('Location: '.$_SERVER['REQUEST_URI']); exit; } // Show message store in session if (isset($_SESSION["message"])) { echo $_SESSION["message"]; unset($_SESSION["message"]); } // Show images already on server and markdown code $imgs_on_server = glob($media_upload."*.{jpg,jpeg,png,gif}", GLOB_BRACE); // Sort image files by date (based on: https://stackoverflow.com/questions/124958/glob-sort-array-of-files-by-last-modified-datetime-stamp usort($imgs_on_server, fn($a, $b) => -(filemtime($a) - filemtime($b))); echo '
Copy the code for images and paste it into the new message box
'; foreach ($imgs_on_server as $img) { $public_file = $config["public_media"] . "/" . basename($img); /* echo ''; echo ''; echo ''; echo ''; //$img = str_replace('../', $base_url, $img); echo '![]('.$public_file.')'; echo ''; */ echo '
'; echo '![]('.$public_file.')'; echo ''; echo '
'; } //echo ''; ?>