HTTP_Upload, filtering of extension
| From: | Louie Miranda | Date: | Tue, 07 Sep 2004 03:01:21 +0000 |
| Subject: | HTTP_Upload, filtering of extension | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14438@lists.php.net to get a copy of this message | ||
Hello,
I got this example from HTTP_Upload, where should i start filtering
the extension?
im assuming on "$file" ?
$upload = new http_upload('en');
$file = $upload->getFiles('userfile');
if (PEAR::isError($file)) {
die ($file->getMessage());
}
if ($file->isValid()) {
$file->setName('uniq');
$dest_dir = './uploads/';
$dest_name = $file->moveTo($dest_dir);
if (PEAR::isError($dest_name)) {
die ($dest_name->getMessage());
}
$real = $file->getProp('real');
echo "Uploaded $real as $dest_name in $dest_dir\n";
} elseif ($file->isMissing()) {
echo "No file selected\n";
} elseif ($file->isError()) {
echo $file->errorMsg() . "\n";
}
--
Louie Miranda
http://www.axishift.com