韦德体育php 上传图片代

  • 栏目:编程 时间:2020-04-03 09:38
<返回列表

简单php 图片上传代码 php 上传图片代

代码如下复制代码

?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();

?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();/script);exit();}if($title==null || $title== || strlen($title)50){$title=暂无标题;}if($say==null || $say== || strlen($say)500){$say=暂无说明;}if(strpos('exit:image/x-png',$uploadtype)){$uploadsava=$uploadpath..png;}if(strpos('exit:image/gif',$uploadtype)){$uploadsava=$uploadpath..gif;}if(strpos('exit:image/pjpeg',$uploadtype)){$uploadsava=$uploadpath..jpg;}if($uploadsava==''){echo(scriptalert('只能上传.gif .jpg .png三类文件');history.back();/script);exit();}if($_FILES['file']['size']202400){echo(scriptalert('对不起,图片大小不能大于200K');history.back();/script);exit();}

if($zpname== || $zpname50){echo(scriptalert('作品名称不能为空或大于50个字符!');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;%/$#/=~]+)*$,$zpurl)){echo(scriptalert('作品地址URL不合法!');history.back();/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==''){echo(scriptalert('对不起,你上传的类型不对,只允许上传 .gif .jpg .png');history.back();/script);exit();}if($_FILES['file']['size']$up_size){echo(scriptalert('上传文件不能大于100K');history.back();/script);exit();}

if(move_uploaded_file($_FILES['file']['tmp_name'],$uploadsava)){echo(scriptalert('图片上传成功');history.back();/script);$sql=insert into photo(name,picpath,picdate,pichit,picsay,filesendid,phototype) values('$title','$uploadsava','$tdate',1,'$say','$xm','$phototype');mysql_query($sql) or die('Insert Data Fail Errors'.mysql_error());}else{echo(scriptalert('图片上传失败');history.back();/script);}

/*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();/script);exit();}*/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'].';/script);}else{echo(scriptalert('未知错误');history.back();/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());}?

?

原创文章 载注明:

上一篇:闲来无事写个PHP5 OOP模型 下一篇:没有了

更多阅读

韦德体育php 上传图片代

编程 2020-04-03
简单php 图片上传代码 php 上传图片代 代码如下复制代码 ?php$zpname=addslashes(isset($_POST['zpname'])?...
查看全文

php 在线问卷调查程序一

编程 2020-04-02
也是昨天用到了一个php在线问卷调查程序哦,客户要在新浪投放广告,所以要统计用户相关信息...
查看全文

Win2000安装Apache PHP4 MySQL

编程 2020-04-02
一、 安装APACHE1.3.9(配置conf目录下的文件) 1. #BindAddress * 改为BindAddress 127.0.0.1 #Servername new.ho...
查看全文

友情链接: 网站地图

Copyright © 2015-2019 http://www.koi-bumi.com. 韦德体育有限公司 版权所有