写入文件后缀!!斑竹帮忙啊
写入文件后缀!!斑竹帮忙啊 现在上传后的文件保存为0PW38Wfbl8.wma.file
我希望保存的文件是0PW38Wfbl8.wma.wma.file
提取文件页是[url]http://www.[/url]
我希望提取文件页是[url]http://www.[/url]
就是希望把后缀加进去啊,斑竹帮忙啊
<?php
require 'global.php';
require 'config.php';
require 'db.php';
$a=strtolower(fileext($_FILES['file']['name']));
if(!in_array(strtolower(fileext($_FILES['file']['name'])),$type))
{
$text=implode(",",$type);
echo "Allowed file type : ",$text," <br> ";
}
else
{
$filename=explode(".",$_FILES['file']['name']);
do{
$filename[0]=random(10);
$name=implode(".",$filename);
$name1=$name.".file";
$uploadfile=$uploaddir.$name1;
}
while(file_exists($uploadfile));
if (move_uploaded_file($_FILES['file']['tmp_name'],$uploadfile)) {
$db=new db;
$db-> connect($dbhost, $dbuser, $dbpwd, $dbname);
$sql="insert into list (code,file) values ('".$filename[0]."','".$name1."')";
if($db-> query($sql))
{echo " <center> The fast download URL: <p> ".$patch."link.php?ref=",$filename[0].$filename[1]," </center> <p> <hr> ";}
else{echo "失败!请刷新或重传";}
}
}
?>