This should be mindless, but it isn't working. I have a file upload section on my website, and I'm just trying to clean up incoming filenames to do basic checking for duplicate files. Specifically, I'm attempting to use explode to separate file extensions (if supplied) from file names. If anyone would recommend a better way, I'm all ears as well.
Here is my test code:
$file = 'temp.pdf';
echo('before explosion, $file is '.$file.'<br>');
explode(".", $file);
echo('after explosion, $file[0] = '.$file[0].'<br>');
echo('after explosion, $file[1] = '.$file[1].'<br>');
and it's output:
before explosion, $file is temp.pdf
after explosion, $file[0] = t
after explosion, $file[1] = e
Obviously, I expect $file[0] to be 'temp', and $file[1] to be 'pdf' - unless I'm really missing something. I've tried escaping the separator, double and single quotes, and adding slashes to the string - all with no effect. Any help appreciated.
Thanks in advance,
Scott