summaryrefslogtreecommitdiff
path: root/upload_file.php
diff options
context:
space:
mode:
Diffstat (limited to 'upload_file.php')
-rw-r--r--upload_file.php39
1 files changed, 15 insertions, 24 deletions
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 @@
-<?php include('config.php'); ?>
+<?php include("config.php"); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
@@ -9,7 +9,7 @@
<body>
<p>
<?php
-function size_readable($size, $max = null, $system = 'si', $retstring = '%01.2f %s') {
+function size_readable($size, $max = null, $system = "si", $retstring = "%01.2f %s") {
// Pick units
$systems['si']['prefix'] = array('B', 'K', 'MB', 'GB', 'TB', 'PB');
$systems['si']['size'] = 1000;
@@ -40,29 +40,20 @@ if (isset($_SERVER['HTTPS'])) {
$url = preg_replace("/^https:\/\//", "http://", $url);
}
- {
- if ($_FILES["file"]["error"] > 0)
- {
- echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
- }
- 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"] . "<br>";
- $fileurl = "$url" . $_FILES["file"]["name"];
- echo "URL: <a href=\"$fileurl\">$fileurl</a><br>";
- echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi");
- }
- }
+if ($_FILES["file"]["error"] > 0) {
+ echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
+} 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"] . "<br>";
+ $fileurl = "$url" . $_FILES["file"]["name"];
+ echo "URL: <a href=\"$fileurl\">$fileurl</a><br>";
+ echo "Size: " . size_readable($_FILES["file"]["size"], null, "bi");
}
-?>
+}
+?>
</p>
<p>
<a href="<?php echo $url; ?>">Back to index</a>