av手机免费在线观看,国产女人在线视频,国产xxxx免费,捆绑调教一二三区,97影院最新理论片,色之久久综合,国产精品日韩欧美一区二区三区

php語言

PHP圖片上傳類帶圖片顯示

時(shí)間:2025-03-13 00:15:47 php語言 我要投稿
  • 相關(guān)推薦

PHP圖片上傳類帶圖片顯示

  這是一個(gè)PHP的文件上傳類帶圖片顯示的.其實(shí)做成函數(shù)就可以了.不過還是做成類好玩一點(diǎn),就跟隨百分網(wǎng)小編一起去了解下吧,想了解更多相關(guān)信息請持續(xù)關(guān)注我們應(yīng)屆畢業(yè)生考試網(wǎng)!

  本來應(yīng)該用JS來驗(yàn)證上傳文件類型的.但懶得做了.

  <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  <htmlxmlns="http://www.w3.org/1999/xhtml">

  <head>

  <metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

  <title>無標(biāo)題文檔</title>

  </head>

  <body>

  <formid="form1"name="upload"enctype="multipart/form-data"method="post"action="upload.php">

  <inputtype="hidden"name="MAX_FILE_SIZE"/>

  <inputtype="file"name="file"/>

  <inputtype="submit"name="Submit"value="提交"/>

  </form>

  </body>

  </html>

  <?php

  Classupload

  {

  var$upload_name;

  var$upload_tmp_address;

  var$upload_server_name;

  var$upload_filetype;

  var$file_type;

  var$file_server_address;

  var$image_w=900;//要顯示圖片的寬

  var$image_h=350;//要顯示圖片的高

  var$upload_file_size;

  var$upload_must_size=50000;//允許上傳文件的大小,自己設(shè)置

  functionupload_file()

  {

  $this->upload_name=$_FILES["file"]["name"];//取得上傳文件名

  $this->upload_filetype=$_FILES["file"]["type"];

  $this->upload_server_name=date("Y_m_dH_i_s").$this->upload_name;

  $this->upload_tmp_address=$_FILES["file"]["tmp_name"];//取得臨時(shí)地址

  $this->file_type=array("image/gif","image/pjpeg");//允許上傳文件的類型

  $this->upload_file_size=$_FILES["file"]["size"];//上傳文件的大小

  if(in_array($this->upload_filetype,$this->file_type))

  {if($this->upload_file_size<$this->upload_must_size)

  {

  echo("上傳成功,謝謝支持");

  $this->file_server_address="D:usrwwwhtmlupload/".$this->upload_server_name;

  move_uploaded_file($this->upload_tmp_address,$this->file_server_address);//從TEMP目錄移出

  echo("<imgsrc=$this->file_server_addresswidth=$this->image_wheight=$this->image_h/>");//顯示圖片

  }

  else

  {

  echo("文件容量太大");

  }

  }

  else

  {

  echo("不支持此文件類型,請重新選擇");

  }

  }

  }

  $dd=newupload;

  $dd->upload_file();

  ?></p

【PHP圖片上傳類帶圖片顯示】相關(guān)文章:

簡單PHP上傳圖片的方法11-05

php多圖片上傳的簡單例子10-09

php上傳與刪除圖片的簡單范例10-13

php多個(gè)文件及圖片上傳實(shí)例詳解08-02

php上傳圖片生成縮略圖07-31

PHP圖片文件怎么上傳實(shí)現(xiàn)代碼10-14

php上傳圖片并打上透明水印的代碼10-20

如何利用php修改上傳圖片尺寸10-18

php實(shí)現(xiàn)圖片縮放功能類08-17