summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaidyn Lev <jadedctrl@teknik.io>2018-04-08 01:40:17 +0000
committerJaidyn Lev <jadedctrl@teknik.io>2018-04-08 01:40:17 +0000
commit52668f35d46206632985ac190d66ada32119f160 (patch)
tree12f38559ae17fdaead6233c6489cec412f7a2d71
parentbd0b2499cfd6c7e302252ccbbf2242068c3ff611 (diff)
downloadinsert-coin-52668f35d46206632985ac190d66ada32119f160.zip
insert-coin-52668f35d46206632985ac190d66ada32119f160.tar.bz2
Renaming files now auto-adds file-extensions
-rw-r--r--README.md2
-rw-r--r--beam.php14
2 files changed, 13 insertions, 3 deletions
diff --git a/README.md b/README.md
index d75e797..971e174 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[!insert-coin](https://coinsh.red/p/logo.png)
+![insert-coin](https://coinsh.red/p/logo-big.png)
insert-coin's a lightweight & simple image-uploading/URL-shortening service.
diff --git a/beam.php b/beam.php
index e952a76..10c948d 100644
--- a/beam.php
+++ b/beam.php
@@ -11,8 +11,15 @@ echo("\n<main>\n");
if (!empty($_POST["desired_filename"]))
{
$file_name = $_POST["desired_filename"];
- $file_name = sanitize_filename($file_name);
- $dest_file = $file_beam_dir . $file_name;
+
+ if (!pathinfo($file_name, PATHINFO_EXTENSION))
+ {
+ $file_name = $file_name . "." .
+ (pathinfo($_FILES["fileToUpload"]["name"],
+ PATHINFO_EXTENSION));
+ }
+
+ echo($file_name);
$beaming_permitted = 0;
}
@@ -29,6 +36,9 @@ else
$beaming_permitted = 1;
}
+$file_name = sanitize_filename($file_name);
+$dest_file = $file_beam_dir . $file_name;
+
if (file_exists($dest_file))
{
$beaming_permitted = 2;