一个电脑“高手”的自述区youkuiyuan.blog.chinaunix.net
youkuiyuan
全部博文(107)
2015年(1)
2014年(1)
2012年(5)
2011年(22)
2010年(12)
2009年(13)
2008年(34)
2007年(19)
tttxxx
emos
yejia805
helfy_xu
pnomc
mr_zeng_
psmzs
bj_story
dutian11
分类:
2008-09-19 15:42:29
if($_POST['Submit']!=""){//文件上传 //print_r($_POST); if ($_FILES['textfield']['tmp_name'] == "") { echo"No File!!"; exit; } //$title= $title_name = $_COOKIE['cp_bianhao']; $dir=ABS_ROOT."M_CPSJ/attachments/"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { $files[] = $filename; } sort($files); foreach($files as $value){ $value_arr=explode("|",$value); if($title_name==$value_arr[0]){ unlink($dir.$value); } } $file_name = ABS_ROOT."M_CPSJ/attachments/".$_COOKIE['cp_bianhao']."|".$_FILES['textfield']['name']; $result=move_uploaded_file($_FILES['textfield']['tmp_name'] , $file_name); chmod($file_name,0777); if(!$result){ print_r($_FILES); } $sql="UPDATE `cpsj_cpda` SET `appendix_path` = '".ABS_ROOT."M_CPSJ/attachments/"."', `appendix_name` = '".$_COOKIE['cp_bianhao']."|".$_FILES['textfield']['name']."' WHERE `cp_bianhao` ='".$title_name."' "; //echo $sql; $result=$db_con->db_query($sql); if($_COOKIE['sn']!=""){ Header("Location:cpda_cx.php"); setcookie("cp_bianhao","",time()-60*60*24*365); setcookie("number","",time()-60*60*24*365); setcookie("sn","",time()-60*60*24*365); } }
上一篇:下拉列表换背景颜色
下一篇:优化PHP代码的40条建议
登录 注册