201009250526476932.jpg 比如类似这个图片文件。上传以后就修改成日期的命名。
这是代码、。
看看哪里错了。
if($_POST['Submit']) { $title=$_POST["title"]; $fl=$_POST["fl"]; $link=$_POST["link"]; $file = $_FILES['file']; $name = $file['name']; $tmp = $file['tmp_name']; $dateFile = date('YmdHis').rand(100,999); $rename = rename($name,$dateFile+"jpg"); move_uploaded_file($tmp, "../upload/".$name); $sql="insert into ad set title='$title',fl='$fl',pic='upload/$name',link='$link'"; mysql_query($sql); mysql_close($conn); echo "<script language='javascript'>"; echo "alert('添加成功!');"; echo " location='addad.php';"; echo "</script>"; }
你的$rename从来没用过啊
move_uploaded_file($tmp, "../upload/".$name); $name改成$rename