时时商务社区
标题:
PHP图片上传类带图片显示
[打印本页]
作者:
新格网络
时间:
2018-2-14 09:40
这是一个PHP的文件上传类带图片显示的.其实做成函数就可以了.不过还是做成类好玩一点.~~~~
本来应该用JS来验证上传文件类型的.但懒得做了.
无标题文档
upload_name = $_FILES["file"]["name"]; //取得上传文件名
$this->upload_filetype = $_FILES["file"]["type"];
$this->upload_server_name = date("Y_m_dH_i_s").$this->upload_name;
$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->upload_filetype,$this->file_type))
{ if($this->upload_file_size upload_must_size)
{
echo("上传成功,谢谢支持");
$this->file_server_address = "D:\usr\www\html\upload/".$this->upload_server_name;
move_uploaded_file($this->upload_tmp_address,$this->file_server_address);//从TEMP目录移出
echo("
[img][/img]
file_server_address width=$this->image_w height=$this->image_h/>"); //显示图片
}
else
{
echo("文件容量太大");
}
}
else
{
echo("不支持此文件类型,请重新选择");
}
}
}
$dd = new upload;
$dd->upload_file();
?>
您可能感兴趣的文章:
简单的PHP图片上传程序
php 图片上传类代码
PHP 图片上传代码
thinkphp实现图片上传功能分享
使用ThinkPHP+Uploadify实现图片上传功能
php多个文件及图片上传实例详解
PHP+jQuery+Ajax实现多图片上传效果
PHP实现图片上传并压缩
两种php实现图片上传的方法
php+ajax+h5实现图片上传功能
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2