实例简单php图片上传类

 更新时间:2016年11月25日 15:58  点击:1669

class Uploadimg{
 private $_fileName="";         //文件域名称 如 'userfile'
 private $_uploadDir = '';       //上传路径 如 ./upload/
 
 /*上传参数配置*/
 private $_config = array(
  'type'=>array('image/jpeg','image/jpg',
    'image/pjpeg','image/gif'),         //上传的类型
  'size'=>1,                     //文件最大容量单位是M
  'width'=>1000,                   //图片的最大宽度
  'height'=>800                   //图片的最大高度
 );
 
 /**
  * 构造函数
  *
  * @param string $fileName
  * @param string $uploadDir
  * @param array $config
  */
 function __construct($fileName,$uploadDir,$config='')
 {
  $this->_fileName = $fileName;
  $this->_uploadDir = $uploadDir;
  if($config == "" or empty($config) or !is_array($config)){
   $this->_config = $this->_config;
  }else{
   $this->_config = $config;
  }
 }
 
 /**
  * 检测容量是否超过
  *
  * @return boolean
  */
 function checkSize()
 {
  if($_FILES[$this->_fileName]['size'] > $this->_config['size']*1024*1024){
   return false;
  }else{
   return true;
  } 
 }
 
 /**
  * 获取图片信息
  *
  * @return boolean
  */
 function getInfo()
 {
  return @getimagesize($_FILES[$this->_fileName]['tmp_name']);
 }
 
 /**
  * 检测后缀名
  *
  * @return boolean
  */
 function checkExt()
 {
  $imageInfo = $this->getInfo();
  if(in_array($imageInfo['mime'],$this->_config['type'])){
   return true;
  }else{
   return false;
  }
 }
 
 /**
  * 获取后缀名
  *
  * @return boolean
  */
 function getExt()
 {
  $imageInfo = $this->getInfo();
  switch($imageInfo['mime']){
   case 'image/jpeg':$filenameExt = '.jpg';break;
   case 'image/jpg':$filenameExt = '.jpg';break;
   case 'image/pjpeg':$filenameExt = '.jpg';break;
   case 'image/gif':$filenameExt = '.gif';break;
   default:break;
  }
  return $filenameExt;  
 }
 
 /**
  * 检测尺寸
  *
  * @return boolean
  */
 function checkWh()
 {
  $imageInfo = $this->getInfo();
  if(($imageInfo[0] > $this->_config['width']) or ($imageInfo[1] > $this->_config['height'])){
   return false;
  }else{
   return true;
  }
 }
 
 /**
  * 上传一张图片
  *
  * @return string or int
  */
 function uploadSingleImage()
 {
  if($this->checkSize() == false){
   return (-3); /*上传容量过大*/
   exit();
  }  
  if($this->checkExt() == true){
   $filenameExt = $this->getExt();
  }else{
   return (-2);  /*上传格式错误*/
   exit();
  }
  if($this->checkWh() == false){
   return (-1);  /*上传图片太宽或太高*/
   exit();
  }
  $file_new_name = date('YmdHis').$filenameExt;
  $file_new_name_upload = rtrim($_SERVER['DOCUMENT_ROOT'],'/').$this->_uploadDir.$file_new_name;
  if(@move_uploaded_file($_FILES[$this->_fileName]['tmp_name'],$file_new_name_upload)){
   return $file_new_name;
  }else{
   return (0); /*上传失败*/
  } 
 }
 
 /**
  * 删除图片
  *
  * @param string $imageName
  * @return boolen
  */
 function delImage($imageName)
 {
  $path = rtrim($_SERVER['DOCUMENT_ROOT'],'/').$this->_uploadDir.$imageName;
  if(unlink($path) == true){
   return true;
  }else{
   return false;
  }
 }
}

<?php
$action = $_GET['action'];
require_once('auc.main.class.inc.php');

$auc = new auc();

if ($action == 'uploadfile') {
 $auc = new auc();
 
 $result = $auc->upload("file");
 if (is_array($result)) {
  echo 'Something Went Wrong';
  echo '<pre>';
  var_dump($result);
  echo '</pre>';
 } else {
  echo 'All OK';
 }
} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>advanced Upload Class - Demo</title>
</head>
<body>
<form action="auc.demo.php?action=uploadfile" method="post" enctype="multipart/form-data">
  <input name="file[]" type="file" /><br />
  <input name="file[]" type="file" /><br />
  <input name="upload" type="submit" value="Upload File" />
</form>
</body>
</html>
<?php  } ?>

类文件

<?php

class auc {
 public $errors = array(); //array used to store any errors that occur.
 public $upload_dir = ''; //the upload_dir being used by the script
 public $make_safe = false; //default don't modify the file name to safe version
 public $max_file_size = 1048576; //Max File Size in Bytes, 1MB
 public $overwrite = false; //default don't overwrite files that already exsist
 public $check_file_type = false; //don't check for file type by default but can check for allowed and denied files.
 public $allowed_mime_types = array('image/jpeg', 'image/png', 'image/gif', 'image/tiff'); //array of allowed mime types used when check_file_type is set to allowed
 public $denied_mime_types = array('application/x-php', 'text/html'); //array of denied mime types used when check_file_type is set to denied
 
 /**
  * Check if the upload dir is valid, if it is not valid attempt to make the dir, if dir is succesfully created chmod it to 0777.
  * If any elments fail return false else set upload_dir and return true.
  * @param string $dir
  * @param boolean $mkdir
  * @return true or false
  */
 public function upload_dir($dir, $mkdir = false) {
  $errors =& $this->errors;
  $status = true;
  
  if (!is_dir($dir)) {
   if ($mkdir) {
    if (!mkdir($dir)) {
     $status = false;
    } else {
     if (!chmod($dir, 0777)) $status = false;
    }
   } else {
    $status = false;
   }
  }
  
  if ($status) {
   $this->upload_dir = $dir;
   return true;
  } else {
   $errors['general'][] = 'Upload Dir is Not Valid and/or a dir could not be created/chmod.';
   return false;
  }
 }
 
 /**
  * check that the upload dir is valid and that it is writeable
  *
  * @param string $dir
  * @return true or false
  */
 public function check_dir($dir) {
  if (!is_dir($dir) || !is_writable($dir)) return false;
  
  return true;
 }
 

 /**
  * make the uploaded file name safe
  *
  * @param string $file_name
  * @return safe file name
  */
 public function make_safe($file_name) {
  return str_replace(' ', '_', $file_name);
 }
  
 /**
  * Check the Attemted Uploads for errors etc if everything goes good move the file, to the upload_dir.
  *
  * @param array $object
  * @return unknown
  */
 public function upload($object) {
  $errors =& $this->errors;
  
  if (empty($errors['general'])) {
   if (empty($this->upload_dir)) $this->upload_dir = dirname(__FILE__).'/'; //if no default upload_dir has been specified used the current dir.
     
   if ($this->check_dir($this->upload_dir)) {
    $files = $_FILES[$object];
    $count = count($files['name']) - 1;
    
    echo '<pre>';
    var_dump($files);
    echo '</pre>';
    
    for ($current = 0; $current <= $count; $current++) {
     $error = '';
     try {
      //check for $_FILES Errors
      switch ($files['error'][$current]) {
       case 0 : break;
       case 1 : $error = $files['name'][$current].' exceeds the upload_max_filesize directive in php.ini'; break;
       case 2 : $error = $files['name'][$current].' exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; break;
       case 3 : $error = $files['name'][$current].' was only partially uploaded'; break;
       case 4 : $error = 'No file was uploaded'; break;
       case 6 : $error = 'Missing a temporary folder'; break;
       case 7 : $error = 'Failed to write '.$files['name'][$current].' to disk'; break;
       case 8 : $error = $files['name'][$current].' stopped by extension'; break;
       default : $error = 'Unidentified Error, caused by '.$files['name'][$current]; break;
      }
      if ($error)
       throw new TrigerErrorException($error, $files['name'][$current]);
      
      //check that the file is not empty
      if ($files['size'][$current] <= 0)
       throw new TrigerErrorException($files['name'][$current].' is empty', $files['name'][$current]);
      
      //check that the file does not exceed the defined max_file_size
      if ($this->max_file_size) {
       if ($files['size'][$current] >= $this->max_file_size)
        throw new TrigerErrorException($files['name'][$current].' exceeds defined max_file_size', $files['name'][$current]);
      }
      
      if ($this->check_file_type == 'allowed' && !in_array($files['type'][$current], $this->allowed_mime_types)) {
       throw new TrigerErrorException($files['name'][$current].' is not an allowed type', $files['name'][$current]);
      } elseif ($this->check_file_type == 'denied' && in_array($files['type'][$current], $this->denied_mime_types)) {
       throw new TrigerErrorException($files['name'][$current].' is a denied type', $files['name'][$current]);
      }
      
      //if make_safe is true call make safe function  
      if ($this->make_safe)
       $files['name'][$current] = $this->make_safe($files['name'][$current]);
      
      //if overwrite is false and the file exists error
      if (!$this->overwrite && file_exists($this->upload_dir.$files['name'][$current]))
       throw new TrigerErrorException($files['name'][$current].' already exsists', $files['name'][$current]);
       
      //move the uploaded file, error if anything goes wrong.
      if (!move_uploaded_file($files['tmp_name'][$current], $this->upload_dir.$files['name'][$current]))
       throw new TrigerErrorException($files['name'][$current].' could not be moved', $files['name'][$current]);
     } catch (TrigerErrorException $e) {
      $errors[$files['name'][$current]][] = $e->Message();
     }
    }
    
    if (empty($errors)) {
     //return true if there where no errors
     return true;
    } else {
     //return the errors array if there where any errros
     return $errors;
    }
   } else {
    //return false as dir is not valid
    $errors['general'][] = "The Specified Dir is Not Valid or is Not Writeable";
    return false;
   }
  }
 } 
}

/**
 * Handle the Exceptions trigered by errors within upload code.
 *
 */
class TrigerErrorException extends Exception {
 protected $file = "";
 public function __construct($message, $file = "", $code = 0) {
  $this->file = $file;
     parent::__construct($message, $code);
 }

   public function Message() {
  return "{$this->message}";
    }
}
?>

class Trees{
 private $_keyId = 'Id';
 private $_keyName = 'Name';
 private $_keyFid = 'Fid';
 
 function __construct($keyId='',$keyName='',$keyFid='')
 {
  if($keyId==""){$this->_keyId = $this->_keyId;}else{$this->_keyId = $keyId;}
  if($keyName==""){$this->_keyName = $this->_keyName;}else{$this->_keyName = $keyName;}
  if($keyFid==""){$this->_keyFid = $this->_keyFid;}else{$this->_keyFid = $keyFid;}
 }
 
 public function treeListAll($fid,$step=0,&$fromArray,&$resultArray)
 {
  $step++;
  foreach ($fromArray as $k=>$v){
   if($v[$this->_keyFid] == $fid){
    $newArray[] = $v;
   }
  }
  if(isset($newArray)){
   foreach ($newArray as $k=>$v){
    $this->treeListAll($v[$this->_keyId],$step,$fromArray,$resultArray);
    $v['Step'] = $step;
    $resultArray[] = $v;
   }
  }
 }
 
 public function getTreeListAll($fid=0,$step=0,&$fromArray,&$resultArray)
 {
  $step++;
  foreach ($fromArray as $k=>$v){
   if($v[$this->_keyFid] == $fid){
    $newArray[] = $v;
   }
  }
  if(isset($newArray)){
   foreach ($newArray as $k=>$v){
    $this->getTreeListAll($v[$this->_keyId],$step,$fromArray,$resultArray);
    $v['Step'] = $step;
    $resultArray[] = $v;
   }
  }  
 }
 
 public function getTreeList($id = 0,&$fromArray)
 {
  $resultArray = array();
  $this->getTreeListAll($id,0,$fromArray,$resultArray);
  $resultArray = array_reverse($resultArray);
  return $resultArray;
 }
 
 public function getTreeArray($id = 0,&$fromArray)
 {
  $result_one_array = $this->getTreeList($id,$fromArray);
  foreach ($result_one_array as $k=>$v){
   $result_two_array[] = array($v[$this->_keyId]);
  }
  if(isset($result_two_array)){
  for ($i=0;$i<count($result_two_array);$i++){
   for ($j=0;$j<count($result_two_array[$i]);$j++){
    $result[] = $result_two_array[$i][$j];
   }
  }
  }else{
   $result = array();
  }
  return $result;
 }

 public function treeListAllTop($fid,$step=0,&$fromArray,&$resultArray)
 {
  $step++;
  foreach ($fromArray as $k=>$v){
   if($v[$this->_keyId] == $fid){
    $newArray[] = $v;
   }
  }
  if(isset($newArray)){
   foreach ($newArray as $k=>$v){
    $this->treeListAllTop($v[$this->_keyFid],$step,$fromArray,$resultArray);
    $v['Step'] = $step;
    $resultArray[] = $v;
   }
  }
 }
 
 public function getTreeListAllTop($fid=0,$step=0,&$fromArray,&$resultArray)
 {
  $step++;
  foreach ($fromArray as $k=>$v){
   if($v[$this->_keyId] == $fid){
    $newArray[] = $v;
   }
  }
  if(isset($newArray)){
   foreach ($newArray as $k=>$v){
    $this->getTreeListAllTop($v[$this->_keyFid],$step,$fromArray,$resultArray);
    $v['Step'] = $step;
    $resultArray[] = $v;
   }
  }  
 }
 
 public function getTreeListTop($id = 0,&$fromArray)
 {
  $resultArray = array();
  $this->getTreeListAllTop($id,0,$fromArray,$resultArray);
  $resultArray = array_reverse($resultArray);
  return $resultArray;
 }
 
 public function getTreeArrayTop($id = 0,&$fromArray)
 {
  $result_one_array = $this->getTreeListTop($id,$fromArray);
  foreach ($result_one_array as $k=>$v){
   $result_two_array[] = array($v[$this->_keyFid]);
  }
  if(isset($result_two_array)){
  for ($i=0;$i<count($result_two_array);$i++){
   for ($j=0;$j<count($result_two_array[$i]);$j++){
    $result[] = $result_two_array[$i][$j];
   }
  }
  }else{
   $result = array();
  }
  return $result;
 }
  
 public function makeOptionString($sourcArray,$firstHint="顶级分类",$selectId=array('-1'),$type=0)
 {
  if($type==0){
   if($firstHint != ""){
    $str = '<option value="0">'.$firstHint.'</option>';
   }else{
    $str = ''; 
   }
   foreach ($sourcArray as $value){
    $level="";
    for($i=1;$i<$value['Step'];$i++){
     $level =$level."----|";
    }
    $selectStr = "";
    if(in_array($value[$this->_keyId],$selectId)){
     $selectStr = "selected";
    }else{
     
    }
    $str.='<option value="'.$value[$this->_keyId].'" '.$selectStr.'>|'.$level.$value[$this->_keyName]."</option>";
    $level="";
   }
  }else{
   $flagStep =-1;
   $str = '<option value="0">'.$firstHint.'</option>';
   foreach ($sourcArray as $value){
    $level="";
    for($i=1;$i<$value['Step'];$i++){
     $level =$level."----|";
    }
    $selectStr = "";
    if($type==$value[$this->_keyId]){
     $flagStep = $value['Step'];
    }else{
     if($flagStep != -1 && $value['Step']>$flagStep){
     
     }else{
      if($flagStep != -1 && $value['Step']<=$flagStep){
       $flagStep = -1;
      }
      if($value[$this->_keyId] == $selectId){
       $selectStr = "selected";
      }
      $str.='<option value="'.$value[$this->_keyId].'" '.$selectStr.'>|'.$level.$value[$this->_keyName]."</option>";
     }
    }
    
    $level="";
   }
  }
  return $str;
 }
}

 
 public function funcStr($str,$num1='',$num2='') //字符正则表达试
 {
  if($num1!='' and $num2!=''){
   return (preg_match("/^[a-zA-Z]{".$num1.",".$num2."}$/",$str))?true:false;
  }else{
   return (preg_match("/^[a-zA-Z]/",$str))?true:false;
  }  
 }
 
 public function funcNum($str,$num1='',$num2='')//数字正则表达试
 {
  if($num1!='' and $num2!=''){
   return (preg_match("/^[0-9]{".$num1.",".$num2."}$/",$str))?true:false;
  }else{
   return (preg_match("/^[0-9]/",$str))?true:false;
  }
 }
 
 public function funcCard($str)//
 {
  return (preg_match('/(^([d]{15}|[d]{18}|[d]{17}x)$)/',$str))?true:false;
 }
 
 public function funcEmail($str)//邮箱正则表达式
 {
  return (preg_match('/^[_.0-9a-z-A-Z-]+@([0-9a-z][0-9a-z-]+.)+[a-z]{2,4}$/',$str))?true:false;
 }
 
 public function funcPhone($str)//电话号码正则表达试
 {
  return (preg_match("/^(((d{3}))|(d{3}-))?((0d{2,3})|0d{2,3}-)?[1-9]d{6,8}$/",$str))?true:false;
 }    
 
 public function funcMtel($str)//手机号码正则表达试
 {
  return (preg_match("/(?:13d{1}|15[03689])d{8}$/",$str))?true:false;
 } 
 
 public function funcZip($str)//邮编正则表达试
 {
  return (preg_match("/^[0-9]d{5}$/",$str))?true:false;
 } 
 
 public function funcUrl($str)//url正则表达试
 {
  return (preg_match("/^http://[A-Za-z0-9]+.[A-Za-z0-9]+[/=?%-&_~`@[]':+!]*([^<>""])*$/",$str))?true:false;
 }  

class Client{
 
 public function __construct()
 {
  /**/
 }
 
 /**
  * 获取浏览器客户端
  *
  * @return string
  */
 public function browser()
 {
  $info = $_SERVER['HTTP_USER_AGENT'];
  if(strstr($info,'MSIE 6.0') != false){
   return 'IE6';
  }elseif (strstr($info,'MSIE 7.0') != false){
   return 'IE7';
  }elseif (strstr($info,'Firefox') != false){
   return 'Firefox';
  }elseif (strstr($info,'Chrome') != false){
   return 'Chrome';
  }elseif (strstr($info,'Safari') != false){
   return 'Safari';         
  }else{
   return 'unknow';
  }
  }
 
     /**
      * 获取操作系统
      * @return string
      */
  public function getOS ()
     {
      $agent = $_SERVER['HTTP_USER_AGENT'];
      $os = false;
      if (eregi('win', $agent) && strpos($agent, '95')){
          $os = 'Windows 95';
      }
      else if (eregi('win 9x', $agent) && strpos($agent, '4.90')){
          $os = 'Windows ME';
      }
      else if (eregi('win', $agent) && ereg('98', $agent)){
         $os = 'Windows 98';
      }
      else if (eregi('win', $agent) && eregi('nt 5.1', $agent)){
          $os = 'Windows XP';
      }
      else if (eregi('win', $agent) && eregi('nt 5', $agent)){
          $os = 'Windows 2000';
      }
      else if (eregi('win', $agent) && eregi('nt', $agent)){
          $os = 'Windows NT';
      }
      else if (eregi('win', $agent) && ereg('32', $agent)){
          $os = 'Windows 32';
      }
      else if (eregi('linux', $agent)){
          $os = 'Linux';
      }
      else if (eregi('unix', $agent)){
          $os = 'Unix';
      }
      else if (eregi('sun', $agent) && eregi('os', $agent)){
          $os = 'SunOS';
      }
      else if (eregi('ibm', $agent) && eregi('os', $agent)){
          $os = 'IBM OS/2';
      }
      else if (eregi('Mac', $agent) && eregi('PC', $agent)){
          $os = 'Macintosh';
      }
      else if (eregi('PowerPC', $agent)){
          $os = 'PowerPC';
      }
      else if (eregi('AIX', $agent)){
          $os = 'AIX';
      }
      else if (eregi('HPUX', $agent)){
          $os = 'HPUX';
      }
      else if (eregi('NetBSD', $agent)){
          $os = 'NetBSD';
      }
      else if (eregi('BSD', $agent)){
          $os = 'BSD';
      }
      else if (ereg('OSF1', $agent)){
          $os = 'OSF1';
      }
      else if (ereg('IRIX', $agent)){
          $os = 'IRIX';
      }
      else if (eregi('FreeBSD', $agent)){
          $os = 'FreeBSD';
      }
      else if (eregi('teleport', $agent)){
          $os = 'teleport';
      }
      else if (eregi('flashget', $agent)){
          $os = 'flashget';
      }
      else if (eregi('webzip', $agent)){
          $os = 'webzip';
      }
      else if (eregi('offline', $agent)){
          $os = 'offline';
      }
      else {
          $os = 'Unknown';
      }
     return $os;
     } 

     /**
      * 获取IP地址
      * @return string
      */
 public function getIp()
 {
  if (getenv("HTTP_CLIENT_IP") && strcasecmp(getenv("HTTP_CLIENT_IP"), "unknown")){
   $ip = getenv("HTTP_CLIENT_IP");
        }elseif (getenv("HTTP_X_FORWARDED_FOR") && strcasecmp(getenv("HTTP_X_FORWARDED_FOR"), "unknown")){
            $ip = getenv("HTTP_X_FORWARDED_FOR");
        }elseif (getenv("REMOTE_ADDR") && strcasecmp(getenv("REMOTE_ADDR"), "unknown")){
            $ip = getenv("REMOTE_ADDR");
        }elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] && strcasecmp($_SERVER['REMOTE_ADDR'], "unknown"))  {
            $ip = $_SERVER['REMOTE_ADDR'];
        }else{
            $ip = "unknown";
        }
        return($ip);
 }    

[!--infotagslink--]

相关文章

  • 使用PHP+JavaScript将HTML页面转换为图片的实例分享

    这篇文章主要介绍了使用PHP+JavaScript将HTML元素转换为图片的实例分享,文后结果的截图只能体现出替换的字体,也不能说将静态页面转为图片可以加快加载,只是这种做法比较interesting XD需要的朋友可以参考下...2016-04-19
  • C#从数据库读取图片并保存的两种方法

    这篇文章主要介绍了C#从数据库读取图片并保存的方法,帮助大家更好的理解和使用c#,感兴趣的朋友可以了解下...2021-01-16
  • Photoshop古装美女图片转为工笔画效果制作教程

    今天小编在这里就来给各位Photoshop的这一款软件的使用者们来说说把古装美女图片转为细腻的工笔画效果的制作教程,各位想知道方法的使用者们,那么下面就快来跟着小编一...2016-09-14
  • Python 图片转数组,二进制互转操作

    这篇文章主要介绍了Python 图片转数组,二进制互转操作,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-09
  • php抓取网站图片并保存的实现方法

    php如何实现抓取网页图片,相较于手动的粘贴复制,使用小程序要方便快捷多了,喜欢编程的人总会喜欢制作一些简单有用的小软件,最近就参考了网上一个php抓取图片代码,封装了一个php远程抓取图片的类,测试了一下,效果还不错分享...2015-10-30
  • jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮

    jquery左右滚动焦点图banner图片鼠标经过显示上下页按钮...2013-10-13
  • Php文件上传类class.upload.php用法示例

    本文章来人大家介绍一个php文件上传类的使用方法,期望此实例对各位php入门者会有不小帮助哦。 简介 Class.upload.php是用于管理上传文件的php文件上传类, 它可以帮...2016-11-25
  • 利用JS实现点击按钮后图片自动切换的简单方法

    下面小编就为大家带来一篇利用JS实现点击按钮后图片自动切换的简单方法。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2016-10-25
  • PHP文件上传一些小收获

    又码了一个周末的代码,这次在做一些关于文件上传的东西。(PHP UPLOAD)小有收获项目是一个BT种子列表,用户有权限上传自己的种子,然后配合BT TRACK服务器把种子的信息写出来...2016-11-25
  • jQuery实现简单的文件上传进度条效果

    本文实例讲述了jQuery实现文件上传进度条效果的代码。分享给大家供大家参考。具体如下: 运行效果截图如下:具体代码如下:<!DOCTYPE html><html><head><meta charset="utf-8"><title>upload</title><link rel="stylesheet...2015-11-24
  • php文件上传你必须知道的几点

    本篇文章主要说明的是与php文件上传的相关配置的知识点。PHP文件上传功能配置主要涉及php.ini配置文件中的upload_tmp_dir、upload_max_filesize、post_max_size等选项,下面一一说明。打开php.ini配置文件找到File Upl...2015-10-21
  • Photoshop枪战电影海报图片制作教程

    Photoshop的这一款软件小编相信很多的人都已经是使用过了吧,那么今天小编在这里就给大家带来了用Photoshop软件制作枪战电影海报的教程,想知道制作步骤的玩家们,那么下面...2016-09-14
  • js实现上传图片及时预览

    这篇文章主要为大家详细介绍了js实现上传图片及时预览的相关资料,具有一定的参考价值,感兴趣的朋友可以参考一下...2016-05-09
  • EXCEL数据上传到SQL SERVER中的简单实现方法

    EXCEL数据上传到SQL SERVER中的方法需要注意到三点!注意点一:要把EXCEL数据上传到SQL SERVER中必须提前把EXCEL传到服务器上.做法: 在ASP.NET环境中,添加一个FileUpload上传控件后台代码的E.X: 复制代码 代码如下: if...2013-09-23
  • python opencv通过4坐标剪裁图片

    图片剪裁是常用的方法,那么如何通过4坐标剪裁图片,本文就详细的来介绍一下,感兴趣的小伙伴们可以参考一下...2021-06-04
  • 使用PHP下载CSS文件中的图片的代码

    共享一段使用PHP下载CSS文件中的图片的代码 复制代码 代码如下: <?php //note 设置PHP超时时间 set_time_limit(0); //note 取得样式文件内容 $styleFileContent = file_get_contents('images/style.css'); //not...2013-10-04
  • DWVA上传漏洞挖掘的测试例子

    DVWA (Dam Vulnerable Web Application)DVWA是用PHP+Mysql编写的一套用于常规WEB漏洞教学和检测的WEB脆弱性测试程序。包含了SQL注入、XSS、盲注等常见的一些安全漏洞...2016-11-25
  • PHP swfupload图片上传的实例代码

    PHP代码如下:复制代码 代码如下:if (isset($_FILES["Filedata"]) || !is_uploaded_file($_FILES["Filedata"]["tmp_name"]) || $_FILES["Filedata"]["error"] != 0) { $upload_file = $_FILES['Filedata']; $fil...2013-10-04
  • 微信小程序如何获取图片宽度与高度

    这篇文章主要给大家介绍了关于微信小程序如何获取图片宽度与高度的相关资料,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-03-10
  • C#中图片旋转和翻转(RotateFlipType)用法分析

    这篇文章主要介绍了C#中图片旋转和翻转(RotateFlipType)用法,实例分析了C#图片旋转及翻转Image.RotateFlip方法属性的常用设置技巧,需要的朋友可以参考下...2020-06-25