BVB Source Codes

V2.0 small chopper editor Show upload.php Source code

Return Download V2.0 small chopper editor: download upload.php Source code - Download V2.0 small chopper editor Source code - Type:.php
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  5. <title>无标题文档</title>
  6. <style type="text/css">
  7. <!--
  8. * {margin:0;padding:0;background:#fff;font:12px Verdana;}
  9. .input  {width:200px;height:22px;}
  10. .button {width:50px;border:1px solid #718da6;height:22px;}
  11. -->
  12. </style>
  13. <!--[if IE]>
  14. <style type="text/css">
  15. .input{border:1px solid #718da6;}
  16. </style>
  17. <![endif]-->
  18. </head>
  19. <body>
  20. <?
  21. if($_GET["action"]=="load"){
  22.     $uptypes = array('image/jpg','image/jpeg','image/png','image/pjpeg','image/gif','image/bmp','image/x-png');
  23.         $url     = "http://".$_SERVER["SERVER_NAME"]. $_SERVER["PHP_SELF"];
  24.         $url     = explode("/upload.php",$url);
  25.         $url     = explode("/",$url[0]);
  26.         $max_file_size = 2*(1024*1024); //上传文件大小限制, 单位BYTE
  27.  
  28.         $root    = "Api_Uppic";
  29.        
  30.         $folder  = date("Y-m",time());
  31.         $authnum = rand()%100000;
  32.        
  33.         if ($_SERVER['REQUEST_METHOD'] == 'POST'){
  34.             if (!is_uploaded_file($_FILES["file"][tmp_name])){
  35.                     exit("<script language=javascript>alert('Please select one file to upload(请选择上传文件)!');history.go(-1);</script>");
  36.                 }
  37.                 $file = $_FILES["file"];
  38.                 if($max_file_size < $file["size"]){//检查文件大小
  39.                     exit("<script language=javascript>alert('Max file size of $max_file_size bytes exceeded(文件大小不能超过2M)!');history.go(-1);</script>");
  40.                 }
  41.                 if(!in_array($file["type"],$uptypes)){//检查文件类型
  42.                     exit("<script language=javascript>alert('Type of the file must be \".jpg/.jpeg/.bmp/.gif/png\"(文件后缀只能是.jpg/.jpeg/.bmp/.gif/png)!');history.go(-1);</script>");
  43.                 }
  44.             if(!@file_exists($root."/".$folder)) mkdir($root."/".$folder);
  45.                
  46.             $filename   = $file["tmp_name"];
  47.             $image_size = getimagesize($filename);
  48.             $pinfo      = pathinfo($file["name"]);
  49.                 $ftype      = $pinfo['extension'];
  50.                 $fileinfo   = $root."/".$folder."/".time().$authnum.".".$ftype;
  51.                
  52.                 if (file_exists($fileinfo) && $overwrite != true){
  53.                     exit("<script language=javascript>alert('同名文件已经存在了!');history.go(-1);</script>");
  54.                 }
  55.                 if(!move_uploaded_file ($filename,$fileinfo)){
  56.                    exit("<script language=javascript>alert('移动文件出错!');history.go(-1);</script>");
  57.                 }
  58.             $pinfo=pathinfo($fileinfo);
  59.             $fname=$pinfo[basename];
  60.                
  61.                 $root = explode("../",$root);
  62.                 $urlpath = "";
  63.                 for($i=0;$i<count($url)-count($root)+1;$i++){
  64.                         $urlpath .= $url[$i]."/";
  65.                 }
  66.                 $urlpath .= $root[count($root)-1]."/";
  67.                
  68.                 $picture  = $urlpath.$folder."/".$fname;
  69.             $id = trim($_POST["id"]);
  70.                 if(!$id) $id = "picture";
  71.                
  72.                 echo "<script language='javascript'>\r\n";
  73.             echo "window.parent.document.getElementById('$id').value='$picture';\r\n";
  74.             echo "window.location.href='upload.php?id=$id';\r\n";
  75.             echo "</script>\r\n";
  76.         }
  77.         exit;
  78. }
  79. ?>
  80. <form action="upload.php?action=load" method="post" enctype="multipart/form-data" name="upform" onSubmit="return checkform();">
  81.         <input name="file" id="file" type="file" class="input" />
  82.         <input name="Submit" type="submit" class="button" value="上 传" />
  83.         <input type="hidden" name="id" id="id" value="<?=$_GET["id"]?>">
  84. </form>
  85. <script language="javascript">
  86. function checkform(){
  87.     if(document.getElementById("file").value == ""){
  88.             //Please select a picture to upload!
  89.                 alert("Please select one file to upload(请选择上传文件)!");
  90.                 return false;
  91.         }
  92. }
  93. </script>
  94. </body>
  95. </html>
downloadupload.php Source code - Download V2.0 small chopper editor Source code
Related Source Codes/Software:
V1.2.0518 hi5360 phones belonging to query the.net version - Adopt cs file, the program without having to compi... 2016-09-15
Data import and export Excel - Export data: is the data stored in CSV format Exce... 2016-09-15
Toolxp.NET play games. Net2.0 Edition - 2009.3.14 update 2016-09-15
Amoy Gardens in wenling P2P free thief v2.1 - Program description: 2016-09-15
Merlin middle school campus network - 1, full admin site. Every piece of information o... 2016-09-15
Fetion interface PHP version (free texting) v1.2 - Put on a letter is always too much memory in the c... 2016-09-15
Tab Tab control and Demo source code - TabWebControl extended attributes 2016-09-15
A custom desktop Silverlight imitation of Google - Recently learned the Silverlight, use it to write ... 2016-09-15
Asp.net small tool v1.0 mysql database management - Software is introduced in the Asp.net, can through... 2016-09-15
V5.2 virtual currency trading site - Virtual currency trading site is a PHP thinkphp as... 2017-05-04
Open source e-commerce (online) v4.7.170303 iWebShop system - New part Increase merchant phone management backg... 2017-05-04
Tea tea food company dream weaving web site source code (with mobile terminal) v2.1 - Latest kernel development dream template, the temp... 2017-05-04
Pure imitation of han site source code, one a 】 【 c9cms kernel v1.0 - Generic http://www.wufazhuce.com/Han one · Config... 2017-05-04
WebOA v17.2 network office automation system - WebOA network using b/s structure development of o... 2017-05-03
Cool HITCMS reactive black v3.0 enterprise website source code - HITCMS-Haitian response black enterprises website ... 2017-05-03
Ray v7.02 speed survey system - Lightning speed survey system is a. NET+MSSQL deve... 2017-05-03
HITCMS Haitian responsive electronic mechanical v3.0 foreign trade website source code - HITCMS Haitian response electronic machinery trade... 2017-05-03
The latest thinkphp v5.2 work order system - Latest thinkphp work order system is a work order ... 2017-05-03
V3.3.6 Workerman high-performance PHP Socket (framework) - High performance PHP Socket framework Workerman re... 2017-05-03

 Back to top