作者:Adonis-唯一 | 来源:互联网 | 2013-03-22 17:06
conn.php:
$id=mysql_connect('localhost','root','root');
mysql_select_db("db_database12",$id);
mysql_query("set names gb2312");
?>index.php:
index_ok.php:
session_start();
include("conn.php");?>
if($Submit=="提交"){
$data=date("Y-m-d");
$file_name="file2";
$path = './upfiles/'. $_FILES['file2']['name'];
if (move_uploaded_file($_FILES['file2']['tmp_name'],$path)) {
$query="insert into tb_file2(file_name,file_text,data)values('$file_name','$path','$data')";
$result=mysql_query($query);
if($result=true){
echo "上传成功!!";
echo "";
}else{echo "文件上传失败!!";
echo "";}
}}
?>