X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=upload.php;h=2509a6b0709ed054011f2ca1531505767199de98;hb=628ac800da5b09fd96a3578a68418e99ab7449b6;hp=e9ff5db4f0c3a255ad1da8a81fc2036ef4ef83e6;hpb=196deb2416748b09200f620247a344563dff4c38;p=wfpl.git diff --git a/upload.php b/upload.php index e9ff5db..2509a6b 100644 --- a/upload.php +++ b/upload.php @@ -1,19 +1,9 @@ . +# This program is in the public domain within the United States. Additionally, +# we waive copyright and related rights in the work worldwide through the CC0 +# 1.0 Universal public domain dedication, which can be found at +# http://creativecommons.org/publicdomain/zero/1.0/ # This file contains functions to accept files being uplodad with the 80)) { + $filename = substr($filename, -80); + } + # remove dots from the beginning (no invisible files) $filename = preg_replace('|^\.*|', '', $filename); - if(strlen($filename > 80)) { - $filename = substr($filename, -80); + # make sure there's something before the extension + if ($filename == '') { + return '_'; } # fix extension @@ -137,6 +133,7 @@ function generate_filename($path, $mime = 'text/plain') { } $filename = $basename . '.' . $ext; } + return $filename; }