upload_filetype = $_FILES["file"]["type"];$this->upload_final_name = date("Y-m-d H:i:s").$this->upload_name;$this->upload_tmp_name"/>
PHP头条
热点:

php上传文件类-PHP源码


[PHP]代码

upload_name = $_FILES["file"]["name"]; //取得上传文件名
			$this->upload_filetype = $_FILES["file"]["type"];
			$this->upload_final_name = date("Y-m-d H:i:s").$this->upload_name;
			$this->upload_tmp_name = $_FILES["file"]["tmp_name"];
			$this->allow_uploadedfile_type = array("image/gif","image/jpeg");
			$this->upload_file_size = $_FILES["file"]["size"];
			$this->upload_target_dir="./upload";
		}

		function upload_file()
		{
			if(in_array($this->upload_filetype,$this->allow_uploadedfile_type))
			{
				if($this->upload_file_size < $this->allow_uploaded_maxsize)
				{
					if(!is_dir($this->upload_target_dir))
					{
						mkdir($this->upload_target_dir);
					}
					$this->upload_target_path = $this->upload_target_dir."/".$this->upload_final_name;
					if(!move_uploaded_file($this->upload_tmp_name,$this->upload_target_path))
					echo "文件上传失败!";
				}
				else
				{
					echo("文件太大,上传失败!");
				}
			}
			else
			{
				echo("不支持此文件类型,请重新选择");
			}
		}

	}

?>

www.phpzy.comtrue/phpyy/5862.htmlTechArticlephp上传文件类-PHP源码 [PHP]代码 upload_name = $_FILES["file"]["name"]; //取得上传文件名$this->upload_filetype = $_FILES["file"]["type"];$this->upload_final_name = date("Y-m-d H:i:s").$this->upload_name;$this->upload_tmp_name...

相关文章

相关频道:

PHP之友评论

今天推荐