From 2dafdedfe29aee7ed19d141bbe0953e94b4a499b Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 22 Nov 2015 21:56:53 +0000 Subject: Various code cleanups --- upload_file.php | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-) (limited to 'upload_file.php') diff --git a/upload_file.php b/upload_file.php index a1b218e..890078a 100644 --- a/upload_file.php +++ b/upload_file.php @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@

0) - { - echo "Return Code: " . $_FILES["file"]["error"] . "
"; - } - else - { - if (file_exists($_FILES["file"]["name"])) - { - echo "Error: " . $_FILES["file"]["name"] . " already exists. "; - } - else - { - move_uploaded_file($_FILES["file"]["tmp_name"], - "./" . $_FILES["file"]["name"]); - echo "Uploaded: " . $_FILES["file"]["name"] . "
"; - $fileurl = "$url" . $_FILES["file"]["name"]; - echo "URL: $fileurl
"; - echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi"); - } - } +if ($_FILES["file"]["error"] > 0) { + echo "Return Code: " . $_FILES["file"]["error"] . "
"; +} else { + if (file_exists($_FILES["file"]["name"])) { + echo "Error: " . $_FILES["file"]["name"] . " already exists. "; + } else { + move_uploaded_file($_FILES["file"]["tmp_name"], "./" . $_FILES["file"]["name"]); + echo "Uploaded: " . $_FILES["file"]["name"] . "
"; + $fileurl = "$url" . $_FILES["file"]["name"]; + echo "URL: $fileurl
"; + echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi"); } -?> +} +?>

Back to index -- cgit v1.2.3