--- a/confirmUpload.php
+++ b/confirmUpload.php
@@ -1,1 +1,46 @@
+upload page';
+ $error = true;
+} else {
+ $imageinfo = getimagesize($_FILES['userfile']['tmp_name']);
+ $source_image_type = $imageinfo['mime'];
+$source_image_width = $imageinfo[0];
+ $source_image_height = $imageinfo[1];
+}
+
+if($error == false && ($source_image_type != 'image/png' && $source_image_type != 'image/jpeg')) {
+ echo "Sorry, we only accept PNG and JPEG images. Your image was of type '$source_image_type'.
";
+ $error = true;
+}
+if($error == false && ($source_image_width < MIN_IMAGE_SIZE || $source_image_height < MIN_IMAGE_SIZE)) {
+ echo "Sorry, we only accept images larger than ".MIN_IMAGE_SIZE." pixels. Your image was $source_image_width x $source_image_height pixels big.
";
+ $error = true;
+}
+
+if($error == false && ($source_image_width != $source_image_height)) {
+ echo "Sorry, we only accept images that are exactly square (the height is the same as the width). Your image was $source_image_width x $source_image_height pixels big.
";
+ $error = true;
+}
+if (!$error) {
+ $fileExtension = ($source_image_type == 'image/png' ? ".png" : ".jpg");
+ $fileDate = getNextAvailableDate();
+ echo "Uploaded file meets all necessary requirements, next available date is $fileDate
";
+ $uploaddir = '/var/spool/uploads/'; # Outside of web root
+ $uploadfile = DATA_DIR . $fileDate . $fileExtension;
+ if (file_exists($uploadfile)) {
+ echo "Oh no! A file for $fileDate already exists! Please retry in a moment
";
+ } else {
+ if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
+ echo "File was successfully uploaded.\n
";
+ } else {
+ echo "File uploading failed.\n
";
+ }
+ }
+}
+include_footer();
+?>