php支持生成缩略图文件上传代码

 更新时间:2016年11月25日 16:58  点击:2245

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>
<?php

class upfileclass {

 var $upfile, $upfile_name, $upfile_size;
 # $upfile 临时文件名 $_files['tmp_name'] ,$upfile_name 文件名 $_files['name'] ,$upfile_size 文件大小$_files['size'];

 var $new_upfile_name;   # 上传后的文件名称 ;
 var $fleth, $fileextent; # 文件扩展名(类型) ;
 var $f1, $f2, $f3;   # 文件保存路径(多级) upfiles/2008-01/08/;
 var $filename;    # 文件(带路径) ;
 var $filepath; #相对路径用来删除文件;
 var $maxsize, $file_type; # 允许上传文件的大小 允许上传文件的类型 ;

 var $buildfile,$newfile,$file_width,$file_height,$rate;

 function upfileclass($upfile,$upfile_name,$upfile_size){
   $this->upfile = $upfile;
   $this->upfile_name = $upfile_name;
   $this->upfile_size = $upfile_size;
   $this->new_upfile_name = $this->createnewfilename($this->upfile_name);
   $this->f1 = "upfiles";
   $this->f2 = $this->f1."/".date('y')."-".date('m');
   $this->f3 = $this->f2."/".date('d');
   $this->filename = $this->f3 . "/" . $this->new_upfile_name;
   $this->maxsize = 500*1024;    # 文件大小 500kb
   $this->file_type = "gif/jpg/jpeg/png/bmp"; # 允许上传的文件类型
 }

 # 创建新文件名 (原文件名)
 function createnewfilename($file_name){
    $this->fleth = explode(".",$file_name);
    $this->fileextent = $this->fleth[(int)count($this->fleth)-1]; # 获取文件后缀;
    $tmps教程tr = date('ymd').rand(0,time()) . "." .$this->fileextent;    # 创建新文件名;
    return $tmpstr;
 }

 # 检测文件类型是否正确
 function chk_fileextent(){
    $iwtrue = 0;
    $fle = explode("/",$this->file_type);
    for($i=0; $i < count($fle); $i++){
     if($this->fileextent == $fle[$i]){
     $iwtrue = (int) $iwtrue + 1;
     }
    }
    if( $iwtrue == 0 ){
  $this->msg("文件不符合 ".$this->file_type." 格式!");
    }
 }

 # 提示错误信息并终止操作
 function msg($error){
    echo "<script language="网页特效"> ";
    echo " alert('".$error."'); ";
    echo " window.history.back(); ";
    echo "</script> ";
    die();
 }

 # 保存文件
 function savefile(){
    $this->chk_fileextent();
    $this->chk_filesize();
    $this->createfolder( "../".$this->f1 );
    $this->createfolder( "../".$this->f2 );
    $this->createfolder( "../".$this->f3 );
    return $this->chk_savefile();
 }

 # 检测上传结果是否成功
 function chk_savefile(){
    $copymsg = copy($this->upfile,"../".$this->filename);
    if( $copymsg ){
   return $this->filename;
    }
    else{
   $this->msg("文件上传失败! 请重新上传! ");
    }
 }

 # 创建文件夹
 function createfolder($foldername){
    if( !is_dir($foldername) ){
   mkdir($foldername,0777);
    }
 }

 # 检测文件大小
 function chk_filesize(){
    if( $this->upfile_size > $this->maxsize ){
  $this->msg("目标文件不能大于". $this->maxsize/1024 ." kb");
    }
 }

 # 删除文件($filepath 文件相对路径)
 function deletefile($filepath){
    if( !is_file($filepath) ){
   return false;
    }
    else{
   $ending = @unlink($filepath);
   return $ending;
    }
 }

 /*
    函数:生成缩略图
  makebuild("/www.111cn.net/a.jpg","news/b.jpg","100");
    参数:
    echo $buildfile;   原图 带路径
    echo $newfile;    生成的缩略图 带路径
    echo $file_width;   缩略图宽度值
    echo $file_height;   缩略图高度值 (默认为宽度的比例值)
    echo $rate;     缩略图象品质;
 */
 function makebuild($buildfile,$newfile,$file_width,$file_height=0,$rate=100) {
    if(!is_file($buildfile)){
   $this->msg("文件 ".$buildfile." 不是一个有效的图形文件! 系统无法生成该文件的缩略图!");
   return false;
    }
    $data = getimagesize($buildfile);
    switch($data[2]){
  case 1:
   $im = @imagecreatefromgif($buildfile);
   break;
  case 2:
   $im = @imagecreatefromjpeg($buildfile);
   break;
  case 3:
   $im = @imagecreatefrompng($buildfile);
   break;
    }
    if(!$im){
   return false;
    }
    else{
   $srcw = imagesx($im);  # 取得原图宽度;
   $srch = imagesy($im); # 取得原图高度;
   $dstx = 0;
   $dsty = 0;
   
  if($file_height==0){
   $file_height = $file_width/$srcw*$srch;
  }
   
  if ($srcw*$file_height>$srch*$file_width){
   $ffile_height = round($srch*$file_width/$srcw);
   $dsty = floor(($file_height-$ffile_height)/2);
   $ffile_width = $file_width;
  }
  else {
   $ffile_width = round($srcw*$file_height/$srch);
   $dstx = floor(($file_width-$ffile_width)/2);
   $ffile_height = $file_height;
  }
  $ni = imagecreatetruecolor($file_width,$file_height);
  $dstx = ($dstx<0)?0:$dstx;
  $dsty = ($dstx<0)?0:$dsty;
  $dstx = ($dstx>($file_width/2))?floor($file_width/2):$dstx;
  $dsty = ($dsty>($file_height/2))?floor($file_height/s):$dsty;
  imagecopyresized($ni,$im,$dstx,$dsty,0,0,$ffile_width,$ffile_height,$srcw,$srch);
   
  imagejpeg($ni,$newfile,$rate); # 生成缩略图;
  imagedestroy($im);     # imagedestroy(resource) 释放image关联的内存
    }
 }

}
?>

</body>
</html>

以前写的验证码程序都是提供了源代码,但是没真的实的图形验证码生成到验证实例,这次我们一个完整的php 验证实例产生了。

有3个文件:
authcode.php-----验证码的生成php文件
authcode.html-----前台显示页面
dealauthcode.php-----ajax提交到的后台处理判断验证码是否正确的处理页面
*/
?>

前台调用验证码代码

 代码如下 复制代码

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>验证码ajax验证</title>
<style type="text/css教程">
        *{ font-size:12px;}
        a{ text-decoration:none;}
        a:hover{ text-decoration:underline; color:red;}
</style>
<script language="网页特效" src="http://code.jquery.com/jquery-1.4.2.min.网页特效"></script>
<script language="网页特效">
        $(document).ready(function(){
                /*----------------看不清楚,换张图片-----------*/
                $("#chang_authcode_btn").click(function(){
                        var authcode_url = "authcode.php?t="+math.random(0,1);
                        $("#authcode_img").attr('src',authcode_url);
                });               
                /*----------------检测验证码-----------*/       
                $("#authcode").bind({
                        'focusin':function(){
                                /**
                                 *得到焦点
                                 *我将img图片移除,若只改变src为'
                                 *'的话,在ie下会呈现出一个无图片的小图片,
                                 *所以我这里选择直接把img元素移除
                                 */
                                $(this).next('label').children('img').remove();
                                $(this).next('label').children('span').text('');
                        },               
                        'focusout':function(){
                                /**
                                 *失去焦点
                                 *这里要做的事情主要有下列几个:
                                 *(1)先用网页特效验证用户输入的验证是不是4位合法的字符,正则匹配
                                 *(2)如果正则匹配失败(不是合法的4位字符),在更新次验证码图片(也就是再触发一次"看不清楚"的a标签的点击事件)
                                 */
                                 var input_authcode = $(this).val();
                                 var authcode_regex = new regexp('^[a-z0-9]{4}','i');
                                 if(!authcode_regex.test(input_authcode)){//不是合法的4位字符串,显示错误信息给用户
                                        $(this).next('label').prepend("<img src='input_error.gif'/>");//加上错误图标
                                        $(this).next('label').children('span').text('输入的验证码格式错误!');//加上错误提示信息
                                        $("#chang_authcode_btn").trigger('click');//再次刷新图片
                                 }else{//ajax服务器验证,就是把用户的输入的验证码提交到服务器上的某个验证页面来处理!
                                         $.get('dealauthcode.php',{authcode:input_authcode},function(check_result){
                                                if(check_result=='mis_match'){//服务器验证没通过
                                                        $("#authcode").next('label').prepend("<img src='input_error.gif'/>");//加上错误图标
                                                        $("#authcode").next('label').children('span').text('验证码输入错误!');//加上错误提示信息
                                                        $("#chang_authcode_btn").trigger('click');//再次刷新图片
                                                }else{//服务器验证通过了
                                                        $("#authcode").next('label').prepend("<img src='input_ok.gif'/>");//加上正确图标
                                                        $("#authcode").next('label').children('span').text('验证码输入正确!');//加上正确提示信息       
                                                }                                                                                
                                         });
                                 }
                        }
                });               
        });
</script>
</head>
<body>
<div >
        <div><img id="authcode_img" src="authcode.php" /> <a id="chang_authcode_btn" style="cursor:pointer">看不清楚?换一张!</a></div>
        <div>验证码:<input id="authcode" type="text" size="20" /><label><span class="error_msg"></span></label></div>
</div>
</body>
</html>

dealauthcode.php-----ajax提交到的后台处理判断验证码是否正确的处理页面

 代码如下 复制代码
<?php
        session_start();
       $authcode = $_get['authcode'];
//这里的$_session['authcode']是在验证码authcode页面产生的
if(strtoupper($authcode)!= $_session['authcode']){   
echo 'mis_match';       
        }
?> 本款程序可以获取图片大小,格式等信息,同时还可以对图片进行缩略图处理与给图片加水印功能哦。
 代码如下 复制代码

class image{
        public $filename;
        private $info;
        private $im;
  

//构造
        public function __construct($filename){
                $this->filename = $filename;
                $this->info    = @getimagesize($filename);
    if($this->info[2]>3){echo "只支持gif、jpeg、png 格式。";exit;}
  
        }
       
// 载入
        public function imgload(){
   switch($this->info[2]){
    case 1:
    $this->im=@imagecreatefromgif($this->filename);
    break; 
    case 2:
    $this->im=@imagecreatefromjpeg($this->filename);
    break; 
    case 3:
    $this->im=@imagecreatefrompng($this->filename);
    break; 
   }
        }

// 保存
        public function imagesave($img,$savename,$inf){
   switch($inf){
    case 1:
    imagegif($img,$savename);;
    break; 
    case 2:
    imagejpeg($img,$savename);;
    break; 
    case 3:
    imagepng($img,$savename);;
    break; 
   }
        }  

  
//滤镜
 public function filter($arg=1,$savename=''){
  $this->imgload();
  
  if($savename=='')$savename='f_'.$this->filename;
     $ok=false;
     switch($arg){
   case 1:
   imagefilter($this->im,img_filter_negate);//反色
   $ok=true;
   break;
   case 2:
   imagefilter($this->im,img_filter_grayscale); //黑白
   $ok=true;
   break;
   case 3:
   imagefilter($this->im,img_filter_emboss);//浮雕
   $ok=true;
   break;
   case 4:
   imagefilter($this->im,img_filter_gaussian_blur); //高斯模糊
   $ok=true;
   break;
   case 5:
   imagefilter($this->im,img_filter_brightness,50); //亮度50
   $ok=true;
   break;
   case 6:
   imagefilter($this->im,img_filter_contrast,-50); //对比度-50
   $ok=true;
   break;  
  }
  if($ok){  
   $this->imagesave($this->im,$savename,$this->info[2]);  //写文件
   imagedestroy($this->im);
   return 1;
  }else{
   imagedestroy($this->im);
   return 0;}
 }
 

 

成条形码就是必须生成图片了,在php生成图片我们就必须用到gd库来实现了,所以你得找到你的将php.ini文件找到extension=php_gd2.dll 去掉前面的;。你就可能使用些实例了。

*/

 代码如下 复制代码

class cd_barra
{
    var $file;
    var $into;
   
    var $cd_barras = array(0=>"00110",1=>"10001",2=>"01001",3=>"11000",4=>"00101",
                           5=>"10100",6=>"01100",7=>"00011",8=>"10010",9=>"01010"
                           );
    function cd_barra($value,$files,$into=1) {
      $lower = 1 ; $hight = 55;         
      $this->into = $into;
      for($count1=9;$count1>=0;$count1--){
        for($count2=9;$count2>=0;$count2--){  
          $count = ($count1 * 10) + $count2 ;
          $text = "" ;
          for($i=1;$i<6;$i++){
            $text .=  substr($this->cd_barras[$count1],($i-1),1) . substr($this->cd_barras[$count2],($i-1),1);
          }
          $this->cd_barras[$count] = $text;
       }
      }
   
          //$img         = imagecreate($lower*95+300,$hight+30);
          $img         = imagecreate(145,55);
   
    //$img         = imagecreate(395,73);  
          $cl_black = imagecolorallocate($img, 0, 0, 0);
          $cl_white = imagecolorallocate($img, 255, 255, 255);
   
              
          
          imagefilledrectangle($img, 0, 0, $lower*95+1000, $hight+30, $cl_white);
          
   
          imagefilledrectangle($img, 1,1,1,53,$cl_black);
          imagefilledrectangle($img, 2,1,2,53,$cl_white);
          imagefilledrectangle($img, 3,1,3,53,$cl_black);
          imagefilledrectangle($img, 4,1,4,53,$cl_white);
   
   
   
    $thin = 1 ;
    if(substr_count(strtoupper($_server['server_software']),"win32")){
        //o tamanho para windows tem que ser 3
        // for windows, the wide bar has = 3
         $wide = 3;
    } else {
            $wide = 2.72;
       }
    $pos   = 5 ;
    $text = $value ;
    if((strlen($text) % 2) <> 0){
        $text = "0" . $text;
    }
   
   
    while (strlen($text) > 0) {
      $i = round($this->barra_left($text,2));
      $text = $this->barra_right($text,strlen($text)-2);
      
      $f = $this->cd_barras[$i];
      
      for($i=1;$i<11;$i+=2){
        if (substr($f,($i-1),1) == "0") {
          $f1 = $thin ;
        }else{
          $f1 = $wide ;
        }
   
      
      imagefilledrectangle($img, $pos,1,$pos-1+$f1,53,$cl_black)  ;
      $pos = $pos + $f1 ;  
      
      if (substr($f,$i,1) == "0") {
          $f2 = $thin ;
        }else{
          $f2 = $wide ;
        }
   
      imagefilledrectangle($img, $pos,1,$pos-1+$f2,53,$cl_white)  ;
      $pos = $pos + $f2 ;  
      }
    }
   
       
    imagefilledrectangle($img, $pos,1,$pos-1+$wide,53,$cl_black);
    $pos=$pos+$wide;
   
    imagefilledrectangle($img, $pos,1,$pos-1+$thin,53,$cl_white);
    $pos=$pos+$thin;
   
   
    imagefilledrectangle($img, $pos,1,$pos-1+$thin,53,$cl_black);
    $pos=$pos+$thin;
   
    $this->put_img($img,$files);
    }
   
    function barra_left($input,$comp){
        return substr($input,0,$comp);
    }
   
    function barra_right($input,$comp){
        return substr($input,strlen($input)-$comp,$comp);
    }
   
    function put_img($image,$file){
        if($this->into){           
   imagegif($image,$file);
        }
  else {
                    header("content-type: image/gif");
                    imagegif($image);
             }
        imagedestroy($image);
    }
}

?>

//调用 方法

 代码如下 复制代码

<?php
  include("codes.php");
 $new_code = new cd_barra("1234567890","a.gif",1);
 
 ?>
   <img src="a.gif"   />

这款图片上传代码可以把上传的图片增加水印,生成小图片,同时还可以生成文字水印。
 代码如下 复制代码
class upimages {
        var $annexfolder = "upload";//附件存放点,默认为:annex
        var $smallfolder = "small";//缩略图存放路径,注:必须是放在 $annexfolder下的子目录,默认为:smallimg
        var $markfolder = "mark";//水印图片存放处
        var $upfiletype = "jpg gif png";//上传的类型,默认为:jpg gif png rar zip
        var $upfilemax = 1024;//上传大小限制,单位是"kb",默认为:1024kb
        var $fonttype;//字体
        var $maxwidth = 500; //图片最大宽度
        var $maxheight = 600; //图片最大高度
        function upimages($annexfolder,$smallfolder,$includefolder) {
                $this->annexfolder = $annexfolder;
                $this->smallfolder = $smallfolder;
                $this->fonttype = $includefolder."/04b_08__.ttf";
        }
        function upload($inputname) {
                $imagename = time();//设定当前时间为图片名称
                if(@empty($_files[$inputname]["name"])) die("没有上传图片信息,请确认");
                $name = explode(".",$_files[$inputname]["name"]);//将上传前的文件以"."分开取得文件类型
                $imgcount = count($name);//获得截取的数量
                $imgtype = $name[$imgcount-1];//取得文件的类型
                if(strpos($this->upfiletype,$imgtype) === false) die(error("上传文件类型仅支持 ".$this->upfiletype." 不支持 ".$imgtype));
                $photo = $imagename.".".$imgtype;//写入数据库教程的文件名
                $uploadfile = $this->annexfolder."/".$photo;//上传后的文件名称
                $upfileok = move_uploaded_file($_files[$inputname]["tmp_name"],$uploadfile);
                if($upfileok) {
                        $imgsize = $_files[$inputname]["size"];
                        $ksize = round($imgsize/1024);
                        if($ksize > ($this->upfilemax*1024)) {
                                @unlink($uploadfile);
                                die(error("上传文件超过 ".$this->upfilemax."kb"));
                        }
                } else {
                        die(error("上传图片失败,请确认你的上传文件不超过 $upfilemax kb 或上传时间超时"));
                }
                return $photo;
        }
        function getinfo($photo) {
                $photo = $this->annexfolder."/".$photo;
                $imageinfo = getimagesize($photo);
                $imginfo["width"] = $imageinfo[0];
                $imginfo["height"] = $imageinfo[1];
                $imginfo["type"] = $imageinfo[2];
                $imginfo["name"] = basename($photo);
                return $imginfo;
        }
        function smallimg($photo,$width=128,$height=128) {
                $imginfo = $this->getinfo($photo);
                $photo = $this->annexfolder."/".$photo;//获得图片源
                $newname = substr($imginfo["name"],0,strrpos($imginfo["name"], "."))."_thumb.jpg";//新图片名称
                if($imginfo["type"] == 1) {
                        $img = imagecreatefromgif($photo);
                } elseif($imginfo["type"] == 2) {
                        $img = imagecreatefromjpeg($photo);
                } elseif($imginfo["type"] == 3) {
                        $img = imagecreatefrompng($photo);
                } else {
                        $img = "";
                }
                if(empty($img)) return false;
                $width = ($width > $imginfo["width"]) ? $imginfo["width"] : $width;
                $height = ($height > $imginfo["height"]) ? $imginfo["height"] : $height;
                $srcw = $imginfo["width"];
                $srch = $imginfo["height"];
                if ($srcw * $width > $srch * $height) {
                        $height = round($srch * $width / $srcw);
                } else {
                        $width = round($srcw * $height / $srch);
                }
                if (function_exists("imagecreatetruecolor")) {
                        $newimg = imagecreatetruecolor($width, $height);
                        imagecopyresampled($newimg, $img, 0, 0, 0, 0, $width, $height, $imginfo["width"], $imginfo["height"]);
                } else {
                        $newimg = imagecreate($width, $height);
                        imagecopyresized($newimg, $img, 0, 0, 0, 0, $width, $height, $imginfo["width"], $imginfo["height"]);
                }
                if ($this->tofile) {
                        if (file_exists($this->annexfolder."/".$this->smallfolder."/".$newname)) @unlink($this->annexfolder."/".$this->smallfolder."/".$newname);
                        imagejpeg($newimg,$this->annexfolder."/".$this->smallfolder."/".$newname);
                        return $this->annexfolder."/".$this->smallfolder."/".$newname;
                } else {
                        imagejpeg($newimg);
                }
                imagedestroy($newimg);
                imagedestroy($img);
                return $newname;
        }
        function watermark($photo,$text) {
                $imginfo = $this->getinfo($photo);
                $photo = $this->annexfolder."/".$photo;
                $newname = substr($imginfo["name"], 0, strrpos($imginfo["name"], ".")) . "_mark.jpg";
                switch ($imginfo["type"]) {
                        case 1:
                                $img = imagecreatefromgif($photo);
                        break;
                        case 2:
                                $img = imagecreatefromjpeg($photo);
                        break;
                        case 3:
                                $img = imagecreatefrompng($photo);
                        break;
                        default:
                                return false;
                }
                if (empty($img)) return false;
                $width = ($this->maxwidth > $imginfo["width"]) ? $imginfo["width"] : $this->maxwidth;
                $height = ($this->maxheight > $imginfo["height"]) ? $imginfo["height"] : $this->maxheight;
                $srcw = $imginfo["width"];
                $srch = $imginfo["height"];
                if ($srcw * $width > $srch * $height) {
                        $height = round($srch * $width / $srcw);
                } else {
                        $width = round($srcw * $height / $srch);
                }
                if (function_exists("imagecreatetruecolor")) {
                        $newimg = imagecreatetruecolor($width, $height);
                        imagecopyresampled($newimg, $img, 0, 0, 0, 0, $width, $height, $imginfo["width"], $imginfo["height"]);
                } else {
                        $newimg = imagecreate($width, $height);
                        imagecopyresized($newimg, $img, 0, 0, 0, 0, $width, $height, $imginfo["width"], $imginfo["height"]);
                }
               
                $white = imagecolorallocate($newimg, 255, 255, 255);
                $black = imagecolorallocate($newimg, 0, 0, 0);
                $alpha = imagecolorallocatealpha($newimg, 230, 230, 230, 40);
                imagefilledrectangle($newimg, 0, $height-26, $width, $height, $alpha);
                imagefilledrectangle($newimg, 13, $height-20, 15, $height-7, $black);
                imagettftext($newimg, 4.9, 0, 20, $height-14, $black, $this->fonttype, $text[0]);
                imagettftext($newimg, 4.9, 0, 20, $height-6, $black, $this->fonttype, $text[1]);
                if($this->tofile) {
                        if (file_exists($this->annexfolder."/".$this->markfolder."/".$newname)) @unlink($this->annexfolder."/".$this->markfolder."/".$newname);
                        imagejpeg($newimg,$this->annexfolder."/".$this->markfolder."/".$newname);
                        return $this->annexfolder."/".$this->markfolder."/".$newname;
                } else {
                        imagejpeg($newimg);
                }
                imagedestroy($newimg);
                imagedestroy($img);
                return $newname;
        }
}
[!--infotagslink--]

相关文章

  • Php文件上传类class.upload.php用法示例

    本文章来人大家介绍一个php文件上传类的使用方法,期望此实例对各位php入门者会有不小帮助哦。 简介 Class.upload.php是用于管理上传文件的php文件上传类, 它可以帮...2016-11-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
  • 借助FileReader实现将文件编码为Base64后通过AJAX上传

    这篇文章主要介绍了借助FileReader实现将文件编码为Base64后通过AJAX上传的方法,包括后端对文件数据解码并保存的PHP代码,需要的朋友可以参考下...2015-12-25
  • jQuery+ajax简单实现文件上传的方法

    这篇文章主要介绍了jQuery+ajax简单实现文件上传的方法,结合实例形式简单分析了jQuery基于ajax的post方法进行文件传输及asp.net后台处理技巧,需要的朋友可以参考下...2016-06-12
  • 适用于初学者的简易PHP文件上传类

    本文实例讲述了PHP多文件上传类,分享给大家供大家参考。具体如下:<&#63;phpclass Test_Upload{ protected $_uploaded = array(); protected $_destination; protected $_max = 1024000; protected $_messages =...2015-10-30
  • c#生成高清缩略图的二个示例分享

    这篇文章主要介绍了c#生成高清缩略图的二个示例,需要的朋友可以参考下...2020-06-25
  • js实现上传文件添加和删除文件选择框

    这篇文章主要为大家详细介绍了js实现上传文件添加和删除文件选择框 ,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2016-10-25
  • PHP利用APC模块实现大文件上传进度条的方法

    php 大文件带进度的上传,一直是一个令php程序员很苦恼的问题。查询baidu 、Google ,大体做带进度的上传方式为:flash+php,socket,apc+php等,下面我介绍了apc +php+ajax制作的带进度的上传,并贴出源码,希望对大家有用。 Altern...2015-10-30
  • C#文件上传的简单实现

    这篇文章主要为大家详细介绍了C#文件上传的简单实现,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2020-06-25
  • js 实现文件上传样式详情

    这篇文章主要介绍了js 实现文件上传样式,下面文章举例说明js 是如何实现文件上传样式的,附有代码详细解说,需要的朋友可以参考一下,希望对你有所帮助...2021-10-21
  • php需登录的文件上传管理系统

    本文给大家介绍一个不错的需要登录的php 文件上传管理系统,功能简单有需要了解的同学可参考。 代码如下<&#63;php$admin_pw="admin";//管理密码$uploaddir="upload";//上传目录session_start();if($_GET['action']=="g...2015-10-30
  • asp.net html控件的File控件实现多文件上传实例分享

    asp.net中html控件的File控件实现多文件上传简单实例,开发工具vs2010使用c#语言,感兴趣的朋友可以了解下,必定是多文件上传值得学习,或许本文所提供的知识点对你有所帮助...2021-09-22
  • JQuery异步提交表单与文件上传功能示例

    这篇文章主要介绍了JQuery异步提交表单与文件上传功能,结合实例形式分析了jQuery表单提交及文件传输操作的相关实现技巧,需要的朋友可以参考下...2017-01-16
  • PHP文件上传主要代码讲解

    复制代码 代码如下:<?php if($_FILES['myfile']['name'] != '') { if($_FILES['myfile']['error'] > 0) { echo "错误状态:" . $_FILES['myfile']['error']; } else { move_uploaded_f...2013-10-04
  • PHP批量生成图片缩略图(1/5)

    这款批量生成缩略图代码可以生成指定大小的小图哦,并且支持文件批量上传。 这款教程会用到php文件 view.php config.php funs.php index.php 功能: -------...2016-11-25
  • 使用jQuery.form.js/springmvc框架实现文件上传功能

    这篇文章主要介绍了使用jQuery.form.jsspringmvc框架实现文件上传功能,非常具有参考借鉴价值,感兴趣的朋友一起学习吧...2016-05-14
  • C#实现为一张大尺寸图片创建缩略图的方法

    这篇文章主要介绍了C#实现为一张大尺寸图片创建缩略图的方法,涉及C#创建缩略图的相关图片操作技巧,需要的朋友可以参考下...2020-06-25
  • php 上传文件并生成缩略图代码

    if( isset($_FILES['upImg']) ) { if( $userGroup[$loginArr['group']]['upload'] == 0 ) { echo '{"error":"您所在的用户组无权上传图片!"}'; } else...2016-11-25