php文件上传代码

?phpif($_FILES[‘file’][‘error’]0){echo’!problem:’;switch($_FILES[‘file’][‘error’]卡塔尔国{case1:echo’文件大小超越劳动器约束’;break;case2:echo’文件太大!’;break;case3:echo’文件只加载了一局地!’;break;case4:echo’文件加载退步!’;break;}exit;}if($_FILES[‘file’][‘size’]1000000卡塔尔国{echo’文件过大!’;exit;}if($_FILES[‘file’][‘type’]!=’image/jpeg’$_FILES[‘file’][‘type’]!=’image/gif’卡塔尔(قطر‎{echo’文件不是JPG只怕GIF图片!’;exit;}$today=date(YmdHis卡塔尔国;$filetype=$_FILES[‘file’][‘type’];if($filetype==’image/jpeg’){$type=’.jpg’;}if($filetype==’image/gif’){$type=’.gif’;}$upfile=’upfile/’.$today.$type;if(is_uploaded_file($_FILES[‘file’][‘tmp_name’])){if(!move_uploaded_file($_FILES[‘file’][‘tmp_name’],$upfile卡塔尔(قطر‎卡塔尔(قطر‎{echo’移动文件失利!’;exit;}}else{echo’problem!’;exit;}echo’h1success!/h1br’;echo’文件大小:’.$_FILES[‘file’][‘size’].’字节’.’Br’;echo’文件路线:’.$upfile;echo’hrwith=100%/’.’p’;$dirr=’upfile/’;$dir=opendir($dirr卡塔尔国;echo$dirr.’–Listing:ul’;while($file=readdir($dir卡塔尔卡塔尔(قطر‎{echoli$file/li;}echo’/ul’;closedir($dir卡塔尔(قطر‎;?

先是种: php部分 复制代码 代码如下:0卡塔尔(قطر‎{
echo’!problem:’; switch($_FILES[‘file’][‘error’]卡塔尔(قطر‎ {
case1:echo’文件大小超过劳动器限定’; break; case2:echo’文件太大!’;
break; case3:echo’文件只加载了一有个别!’; break;
case4:echo’文件加载失败!’; break; } exit; }
if($_FILES[‘file’][‘size’]>1000000State of Qatar{ echo’文件过大!’; exit; }
if($_FILES[‘file’][‘type’]!=’image/jpeg’&&$_FILES[‘file’][‘type’]!=’image/gif’卡塔尔(قطر‎{
echo’文件不是JPG只怕GIF图片!’; exit; } $today=date;
$filetype=$_FILES[‘file’][‘type’]; if($filetype==’image/jpeg’){
$type=’.jpg’; } if($filetype==’image/gif’){ $type=’.gif’; }
$upfile=’upfile/’.$today.$type;
if(is_uploaded_file($_FILES[‘file’][‘tmp_name’])) {
if(!move_uploaded_file($_FILES[‘file’][‘tmp_name’],$upfile卡塔尔国卡塔尔国 {
echo’移动文件退步!’; exit; } } else { echo’problem!’; exit; } echo’

success!

‘; echo’文件大小:’.$_FILES[‘file’][‘size’].’字节’.’
‘; echo’文件路线:’.$upfile; echo”.’

‘; $dirr=’upfile/’; $dir=opendir; echo$dirr.’–Listing:

  • $file

‘; closedir; ?>第三种: 复制代码
代码如下:

“; echo”alert;”; echo”location=’add_aaa.php?pname=$file2′”; echo””;
}//ENDIF } ?>

You can leave a response, or trackback from your own site.

Leave a Reply

网站地图xml地图