日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產(chǎn)品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
PHP上傳類實現(xiàn)單個和批量上傳

PHP上傳類還是比較常用的,于是我研究了一下PHP上傳類,在這里拿出來和大家分享一下,希望對大家有用。PHP本身是一種簡單而強大的語言。PHP語言擁有核心特性如強大的字符串和數(shù)組處理能力,同時極大的改進了對面向?qū)ο缶幊痰闹С郑≒HP5以上版本)。

#T#通過使用標準的和可選的擴展模塊,PHP應用程序可以連接MySQL或Oracle等十幾種數(shù)據(jù)庫、繪圖、創(chuàng)建PDF文件和創(chuàng)建解析XML文件。你也可以使用C語言來寫自己的PHP擴展模塊。例如,在已存在的代碼庫中提供一個PHP的接口函數(shù)。你也可以在Windows下運行PHP,使用COM控制其它諸如Word和Excel的Windows應用程序,或者使用ODBC來連接數(shù)據(jù)庫。在國內(nèi),PHP曾經(jīng)和微軟的ASP并駕齊驅(qū),是大家常用的網(wǎng)絡編程語言?!?/p>

PHP上傳類代碼:

 
 
  1. /**  
  2. *@packagemyFrameworkuploadclass  
  3. *@Descriptionuploadclass  
  4. *@Date2007-11-28  
  5. *@authorantsnet  
  6. *@copyrighthttp://www.antsnet.net  
  7. *@Emailantsnet@163.com  
  8. *@Environment:Apache2.0.59+PHP5.2.5+mysql5.0  
  9. *@version$Id:myFrame_Upload.php22008-02-2701:14:05ZAdministrator$  
  10. */  
  11. classmyFrame_UploadextendsmyFrame  
  12. {  
  13. var$uploadPath="uploadFile/";  
  14. var$fullPath='';  
  15. var$message;  
  16. var$_debug=false;  
  17. var$errorMessage='';  
  18.  
  19. function__construct($uploadPath='')  
  20. {  
  21. if($uploadPath!="")  
  22. {  
  23. $this->uploadPath=$uploadPath;  
  24. }  
  25. }  
  26. /**  
  27. *Batchupload  
  28. *  
  29. *@paramArray$arrayOutPut  
  30. */  
  31. publicfunctionformLocalBatch($keepSource=false,$arrayOutPut='')  
  32. {  
  33. $returnArray=array();  
  34. if(sizeof($_FILES)==$arrayOutPut&&!$keepSource)  
  35. {  
  36. $i=0;  
  37. foreach($_FILESas$index=>$value)  
  38. {  
  39. $returnArray[]=$this->fromLocal($value,$outPutName[$i]);  
  40. $i++;  
  41. }  
  42. }else{  
  43. foreach($_FILESas$index=>$value)  
  44. {  
  45. $returnArray[]=$this->fromLocal($value);  
  46. }  
  47. }  
  48. return$returnArray;  
  49. }  
  50. /**  
  51. *Uploadfileformlocal  
  52. *  
  53. *@paramArray|String$file_Area_Name  
  54. *@paramArray|String$outPutName  
  55. */  
  56. publicfunctionfromLocal($VALUE,$outPutName='')  
  57. {  
  58.  
  59. include_once(SERVERROOT.MYFRAME.'myFrame_Basic.php');  
  60. /**  
  61. *thefollowingforsingle  
  62. */  
  63. if($outPutName==''||$outPutName=="NULL")  
  64. {  
  65. $outPutName=date("YmdHis");  
  66. }  
  67. if($VALUE['error']>0)  
  68. {  
  69. switch($VALUE['errror'])  
  70. {  
  71. case'1':  
  72. $this->errorMessage[]=$this->myFrameMessage['false']['file']['max'];  
  73. returnfalse;  
  74. break;  
  75. case'2':  
  76. $this->errorMessage[]=$this->myFrameMessage['false']['file']['maxDefined'];  
  77. returnfalse;  
  78. break;  
  79. case'3':  
  80. $this->errorMessage[]=$this->myFrameMessage['false']['file']['uncomplite'];  
  81. returnfalse;  
  82. break;  
  83. case'4':  
  84. $this->errorMessage[]=$this->myFrameMessage['false']['file']['unupload'];  
  85. returnfalse;  
  86. break;  
  87.  
  88. }  
  89. }  
  90. $fileName=$this->uploadPath.$outPutName.myFrame_Basic::getFileName($VALUE['name']).myFrame_Basic::getFileExt($VALUE['name']);  
  91. if(is_uploaded_file($VALUE['tmp_name']))  
  92. {  
  93. if(!move_uploaded_file($VALUE['tmp_name'],$fileName))  
  94. {  
  95. $this->errorMessage[]=$this->myFrameMessage['false']['file']['move'];  
  96. returnfalse;  
  97. }else{  
  98. return$fileName;  
  99. }  
  100. }  
  101. }  
  102. /**  
  103. *Uploadfromnetwork  
  104. *  
  105. *@paramArray|String$url  
  106. *@paramArray|String$outPutName  
  107. *@paramBool$keepSource  
  108. */  
  109. publicfunctionfromNet($url,$outPutName='',$keepSource=false)  
  110. {  
  111. include_once(SERVERROOT.MYFRAME.'myFrame_Basic.php');  
  112. if($outPutName=="")  
  113. {  
  114. $outPutName=date("YmdHis");  
  115. }  
  116. $fileType=myFrame_Basic::getFileExt($url);  
  117. $fileName=$outPutName.$fileType;  
  118. $contents=file_get_contents($url);  
  119. $return=file_put_contents($this->uploadPath.$fileName,$contents);  
  120. if($return){  
  121. $this->fullPath=$this->uploadPath.$fileName;  
  122. return$this->fullPath;  
  123. }else{  
  124. $this->errorMessage[]=$this->myFrameMessage['false']['file']['url'];  
  125. returnfalse;  
  126. }  
  127. }  

本文題目:PHP上傳類實現(xiàn)單個和批量上傳
文章網(wǎng)址:http://m.5511xx.com/article/djjiddc.html