ereg(regular expression, string, [match part of array name]);
For more details, please see: http://www.bkjia.com/phper/18/2a94e504e94424a7a461342d049c0018.htm
This program uses ereg to verify whether the file type and file name uploaded by the user comply with the file naming rules.
*/
if( !is_uploaded_file($upfile) )
{
echo("You didn't upload anything!");
exit();
}
else
{
if( !ereg(".(htm|html)$", $upfile_name) )
{
echo("dedecms template can only use .htm or .html extension!");
exit();
}
if( ereg("[/]",$upfile_name) )
{
echo("The template file name contains illegal characters and is prohibited from uploading! -1");
exit();
}
move_uploaded_file($upfile, $templetdird.'/'.$upfile_name);
@unlink($upfile);
echo("Successfully uploaded a file!");
exit();
}
exit();