這是一個PHP的文件上傳類帶圖片顯示的.其實做成函數就可以了.不過還是做成類好玩一點.~~~~
本來應該用JS來驗證上傳文件類型的.但懶得做了.
html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional. ">
function upload_file()
{
$this->upload_name =檔案名稱
$this->upload_filetype = $_FILES["file"]["type"];
$this->upload_server_name = date("Y this->upload_tmp_address = $_FILES["file"]["tmp_name"]; //取得臨時位址
$this->file_type = array("image/gif","image/pjpeg)/上傳檔案的類型
$this->upload_file_size = $_FILES["file"]["size"]; //上傳檔案的大小
if(in_array($this-1loadd)> ))
{ if($this->upload_file_size upload_must_size)
{
ress = "D: usrwwwhtmlupload/".$this->upload_server_name; file_server_address width =$this->image_w height=$this->image_h/>"); //顯示圖片
) }
}
else
{
🎜 >
}
$dd = new upload;
$dd->upload_file();
?>
http://www.bkjia.com/PHPjc/317215.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/317215.html
TechArticle
這是一個PHP的文件上傳類帶圖片顯示的.其實做成函數就可以了.不過還是做成類好玩一點.~~~~ 本來應該用JS來驗證上傳文件類型的.但懶得做了...