tinybox

Code for file upload software on up.concealed.world.
git clone git://git.concealed.world/tinybox
Log | Files | Refs | README | LICENSE

commit e94d7d2df2af0a04243b487a29d28e388bbdcee0
parent fb3b17613ffd199271481c586224fcc820b3e976
Author: Nixx <nixx@firemail.cc>
Date:   Thu, 10 Feb 2022 18:35:44 +0000

More extension checking

Diffstat:
Mindex.php | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/index.php b/index.php @@ -24,8 +24,12 @@ $url = $protocol.$_SERVER['HTTP_HOST']; if($_FILES){ $origname = $_FILES['upload']['name']; - $ext = strtolower(substr($origname, strripos($origname, '.') + 1)); - $name = round(microtime(true)).mt_rand().'.'.$ext; + $name = round(microtime(true)).mt_rand(); + $extpos = strripos($origname, '.'); + if($extpos){ + $ext = strtolower(substr($origname, $extpos + 1)); + $name = $name.".".$ext; + } if($_FILES['upload']['size'] > $maxsize){ exit("ERR: Filesize too large.\n");