Renaming files now auto-adds file-extensions
This commit is contained in:
parent
bd0b2499cf
commit
52668f35d4
|
@ -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.
|
insert-coin's a lightweight & simple image-uploading/URL-shortening service.
|
||||||
|
|
||||||
|
|
14
beam.php
14
beam.php
|
@ -11,8 +11,15 @@ echo("\n<main>\n");
|
||||||
if (!empty($_POST["desired_filename"]))
|
if (!empty($_POST["desired_filename"]))
|
||||||
{
|
{
|
||||||
$file_name = $_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;
|
$beaming_permitted = 0;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +36,9 @@ else
|
||||||
$beaming_permitted = 1;
|
$beaming_permitted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file_name = sanitize_filename($file_name);
|
||||||
|
$dest_file = $file_beam_dir . $file_name;
|
||||||
|
|
||||||
if (file_exists($dest_file))
|
if (file_exists($dest_file))
|
||||||
{
|
{
|
||||||
$beaming_permitted = 2;
|
$beaming_permitted = 2;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue