"; echo "Class $classname method:" . sizeof($ary) . "\n"; for ($i=0; $iClass $classname properties:" . sizeof($ary) . "\n"; for (reset($ary); $key=key($ary); next($ary)) { echo "$key : $ary[$key]" . "\n"; } echo ""; } //取得資訊 function getinfo($fdname) { global $HTTP_POST_FILES; $this->tmpFile = $HTTP_POST_FILES[$fdname]['tmp_name']; $this->fileName = $HTTP_POST_FILES[$fdname]['name']; $this->fileType = $HTTP_POST_FILES[$fdname]['type']; $this->fileSize = $HTTP_POST_FILES[$fdname]['size']; $tmp = explode(".", $this->fileName); $this->name = $tmp[0]; $this->extName = $tmp[1]; } //儲存 function save($fn="") { $this->limit(); if ($this->err) { //Nothing to do } else { $rst = @copy($this->tmpFile, $this->fileDir . $this->name . "." . $this->extName); } return $rst; } //限制 function limit() { //檔案容量 if ($this->sizeLimit && ($this->fileSize > $this->sizeLimit)) { $this->err .= "檔案超過" . $this->sizeLimit . "Byte 容量限制\n"; } //檔案類型 if ($this->typeLimit) { $tmp = explode("|", $this->typeLimit); for ($i=0;$iextName)==strtolower($tmp[$i])) { $typeOk = 1; break; } } if (!$typeOk) { $this->err .= "檔案類型必須為" . $this->typeLimit . "\n"; } } //圖形寬高 if(preg_match("/image/", $this->fileType)) { $imageSize = getImageSize($this->tmpFile); //Get the size of a GIF, JPEG, PNG or SWF image $imgW = $imageSize[0]; $imgH = $imageSize[1]; if ($this->widthLimit && $imgW > $this->widthLimit) $this->err .= "圖檔寬度必須小於為" . $this->widthLimit . "\n"; if ($this->heightLimit && ($imgH >$this->heightLimit)) $this->err .= "圖檔高度必須小於為" . $this->widthLimit . "\n"; } } } ?>