av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

PHP上傳類實現(xiàn)單個和批量上傳

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

#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ù)庫。在國內,PHP曾經(jīng)和微軟的ASP并駕齊驅,是大家常用的網(wǎng)絡編程語言?!?/p>

PHP上傳類代碼:

 
 
  1. /**  
  2. *@packagemyFrameworkuploadclass  
  3. *@Descriptionuploadclass  
  4. *@Date2007-11-28  
  5. *@authorantsnet  
  6. *@copyrighthttp://www.antsnet.net  
  7. *@[email protected]  
  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)單個和批量上傳
本文路徑:http://uogjgqi.cn/article/djjiddc.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流