澳门新葡亰平台官网php文件上传代码

代码如下复制代码

同理可得php 图片上传代码 php 上传图片代

?php$uploadpath=’../upload/’;$uploadtype=’image/x-pngimage/gifimage/pjpeg’;$uploadsava=”;$uploadpath.=md5(date(‘y:m:d
h:i:s’));$phototype=isset($_POST[‘select’])?$_POST[‘select’]:;$title=Strreplace(isset($_POST[‘title’])?$_POST[‘title’]:null);$say=Strreplace(isset($_POST[‘textarea’])?$_POST[‘textarea’]:null);$tdate=date(Y:m:d);$uploadtype=$_FILES[‘file’][‘type’];if
($phototype==’null’ ||
$phototype==卡塔尔国{echo(scriptalert(‘图片上传退步,你还尚无成立相册’卡塔尔国;history.back(卡塔尔;/scriptState of Qatar;exit(State of Qatar;}if($title==null
|| $title== || strlen($title卡塔尔(قطر‎50卡塔尔(قطر‎{$title=暂时未有标题;}if($say==null ||
$say== ||
strlen($sayState of Qatar500卡塔尔(قطر‎{$say=暂无表达;}if(strpos(‘exit:image/x-png’,$uploadtype卡塔尔国卡塔尔(قطر‎{$uploadsava=$uploadpath..png;}if(strpos(‘exit:image/gif’,$uploadtypeState of Qatar卡塔尔国{$uploadsava=$uploadpath..gif;}if(strpos(‘exit:image/pjpeg’,$uploadtypeState of Qatar卡塔尔(قطر‎{$uploadsava=$uploadpath..jpg;}if($uploadsava==”State of Qatar{echo(scriptalert(‘只好上传.gif
.jpg
.png三类文件’卡塔尔(قطر‎;history.back(State of Qatar;/script卡塔尔(قطر‎;exit(State of Qatar;}if($_FILES[‘file’][‘size’]202400卡塔尔{echo(scriptalert(‘对不起,图片大小不可能压倒200K’卡塔尔(قطر‎;history.back(State of Qatar;/scriptState of Qatar;exit(卡塔尔国;}

?php$zpname=addslashes(isset($_POST[‘zpname’])?$_POST[‘zpname’]:”);$zpurl=isset($_POST[‘zpurl’])?$_POST[‘zpurl’]:”;$zpsay=addslashes(isset($_POST[‘zpsay’])?$_POST[‘zpsay’]:”);$blueidea=isset($_POST[‘blueidea’])?$_POST[‘blueidea’]:”;$up_path=../zp/;$up_size=100000;$up_name=md5(date(Y:m:d
H:i:s));$up_type=$_FILES[‘file’][‘type’];$up_exten=start:image/gifimage/pjpegimage/x-png;echo
$up_type;echo(strrpos($up_exten,$up_type));//exit();//=$up_wh[‘mime’];$up_sava=”;//echo($_FILES[‘file’][‘size’]);//echo($_FILES[‘file’][‘type’]);//exit();

if(move_uploaded_file($_FILES[‘file’][‘tmp_name’],$uploadsava卡塔尔State of Qatar{echo(scriptalert(‘图片上传成功’卡塔尔国;history.back(卡塔尔;/script卡塔尔国;$sql=insert
into photo(name,picpath,picdate,pichit,picsay,filesendid,phototype卡塔尔国values(‘$title’,’$uploadsava’,’$tdate’,1,’$say’,’$xm’,’$phototype’State of Qatar;mysql_query($sql)
or die(‘Insert Data Fail
Errors’.mysql_error(卡塔尔国卡塔尔(قطر‎;}else{echo(scriptalert(‘图片上传战败’卡塔尔;history.back(卡塔尔国;/scriptState of Qatar;}

if($zpname== ||
$zpname50卡塔尔{echo(scriptalert(‘文章名称无法为空或超越肆17个字符!’);history.back();/script);exit();}if(!ereg(^(http||ftp)/://((([a-zA-Z0-9/-]+/.){1,}[a-zA-Z]{2,4})|(localhost))(:[0-9]+){0,1}(/[a-zA-Z0-9/-/_/,/.//+amp;%/$#/=~]+)*$,$zpurlState of QatarState of Qatar{echo(scriptalert(‘作品地址UQX56L非法!’State of Qatar;history.back(State of Qatar;/script卡塔尔国;exit(卡塔尔;}if($zpsay==
||
$zpsay500卡塔尔(قطر‎{echo(scriptalert(‘小说简要介绍不可能为空或超过500个字符!’);history.back();/script);exit();}if(strrpos($up_exten,’image/x-png’)){$up_sava=$up_path.$up_name.’.png’;}if(strrpos($up_exten,’image/pjpeg’)){$up_sava=$up_path.$up_name.’.jpg’;}if(strrpos($up_exten,’image/gif’)){$up_sava=$up_path.$up_name.’.gif’;}if($up_sava==”State of Qatar{echo(scriptalert(‘对不起,你上传的门类不对,只允许上传
.gif .jpg
.png’State of Qatar;history.back(卡塔尔;/script卡塔尔国;exit(卡塔尔国;}if($_FILES[‘file’][‘size’]$up_sizeState of Qatar{echo(scriptalert(‘上传文书不可能超越100K’State of Qatar;history.back(卡塔尔;/script卡塔尔国;exit(卡塔尔;}

?

/*print_r($up_wh[‘mime’]);exit();if($up_wh[0]300 || $up_wh400
|| $up_wh[0]93 ||
$up_wh63卡塔尔{echo(scriptalert(‘图片宽度93-300以内,高度400-63以内’卡塔尔(قطر‎;history.back(卡塔尔(قطر‎;/scriptState of Qatar;exit(State of Qatar;}*/if(move_uploaded_file($_FILES[‘file’][‘tmp_name’],$up_sava)){up_insert($zpname,$zpurl,$zpsay,$blueidea,$up_name.’.gif’卡塔尔;echo(scriptalert(‘上传成功’卡塔尔(قطر‎;location=’.$_SERVER[‘HTTP_REFERER’].’;/scriptState of Qatar;}else{echo(scriptalert(‘未知错误’卡塔尔(قطر‎;history.back(State of Qatar;/script卡塔尔(قطر‎;}function
up_insert($zpname,$zpurl,$zpsay,$blueidea,$up_filename){$up_sava=zp/.$up_filename;connect();mysql_query($sql)
or die(‘Insert into data fail:’.mysql_error());}?

原创作品 载评释:

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

Leave a Reply

网站地图xml地图