时间:2021-07-01 10:21:17 帮助过:2人阅读
function getname($exname){
$dir = "upimages/";
$i=1;
if(!is_dir($dir)){
mkdir($dir,0777);
}
while(true){
if(!is_file($dir.$i.".".$exname)){
$name=$i.".".$exname;
break;
}
$i++;
}
return $dir.$name;
}
$exname=strtolower(substr($_FILES['upfile']['name'],(strrpos($_FILES['upfile']['name'],'.')+1)));
$uploadfile = getname($exname);
move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile);
if(trim($_FILES['upfile']['name']!=""))
{
$uploadfile="admin/".$uploadfile;
}
else
{
$uploadfile="";
}
http://www.gxlcms.com/article/25796.htm
https://zhidao.baidu.com/question/518135733.html
看看这个,对你应该有帮助。