|
发表于 2009-5-27 21:49:52
|
显示全部楼层
PHP复制代码 function set_filename ($path, $filename)
{
if ($this->encrypt_name == TRUE)
{
//mt_srand();
//$filename = md5(uniqid(mt_rand())).$this->file_ext;
date_default_timezone_set('PRC');
$filename=date('YmdHis').rand(1,9999).$this->file_ext;
}
if ( ! file_exists($path.$filename))
{
return $filename;
}
$filename = str_replace($this->file_ext, '', $filename);
$new_filename = '';
for ($i = 1; $i < 100; $i++)
{
if ( ! file_exists($path.$filename.$i.$this->file_ext))
{
$new_filename = $filename.$i.$this->file_ext;
break;
}
}
if ($new_filename == '')
{
$this->set_error('upload_bad_filename');
return FALSE;
}
else
{
return $new_filename;
}
} 复制代码
把library里的upload.php重命名规格稍改下,我改的是直接用时间日期来做的上传后的文件名. |
评分
-
查看全部评分
|