作者:Sunlight丶丶丶 | 来源:互联网 | 2018-07-17 06:52
ec(2);简单php图片上传代码php上传图片代<?php$zpnameaddslashes(isset($_POST[zpname])?$_POST[zpname]:);$zpurlisset($_POST[zpurl])?$_POST[zpurl]:;$zpsayaddslashes(isset($_POST[zpsay])?
简单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();
if($zpname=="" || $zpname>50){
echo("");
exit();
}
if(!ereg("^(http|https|ftp)\://((([a-zA-Z0-9\-]+\.){1,}[a-zA-Z]{2,4})|(localhost))(:[0-9]+){0,1}(/[a-zA-Z0-9\-\_\,\./\+&%\$#\=~]+)*$",$zpurl)){
echo("");
exit();
}
if($zpsay=="" || $zpsay>500){
echo("");
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("");
exit();
}
if($_FILES['file']['size']>$up_size){
echo("");
exit();
}
/*print_r($up_wh['mime']);
exit();
if($up_wh[0]>300 || $up_wh>400 || $up_wh[0]<93 || $up_wh<63){
echo("");exit();
}
*/
if(move_uploaded_file($_FILES['file']['tmp_name'],$up_sava)){
up_insert($zpname,$zpurl,$zpsay,$blueidea,$up_name.'.gif');
echo("");
}else{
echo("");
}
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());
}
?>