1024 * 1024 * 5) throw new Exception("Upload exceeds maximum file size."); if (file_exists($strDestinationPath)) throw new Exception("Destination file already exists."); foreach (["/\.jpg$/", "/\.png$/"] as $strExtension) if (preg_match_all($strExtension, $strDestinationPath)) $intAllow = 1; if ($intAllow == 0) throw new Exception("File type not allowed."); $intResult = move_uploaded_file($varFile["tmp_name"], $strDestinationPath); if (!$intResult) throw new Exception("Problem uploading file."); } catch (Exception $x) { PageRender::message($x->getMessage(), "danger"); } } ?>