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
\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;