<?php
header("Content-Type: text/html; charset=utf-8");
// print_r($_FILES);
if(!is_dir(‘uploads‘))
{
mkdir(‘uploads‘);
}
$t_name=$_FILES["files"]["tmp_name"];
$name=$_FILES["files"]["name"];
$a=explode(".", $name);
$b=array_pop($a);
$names=time().mt_rand();
$ture_name=$names.".".$b;
$path=‘uploads/‘.$ture_name;
if ($_FILES["files"]["error"]==0) {
if (move_uploaded_file($t_name,$path)) {
echo "上传成功";
}
}
?>