Linux中国 Linux中国门户站!
设为主页 设为主页
收藏本站 收藏本站
 
当前位置 :首页 ->编程语言 ->PHP4/PHP5 ->正文

PHP实现图片简单上传

来源:Linuxdby.com 作者:Webmaster 时间:2007-06-01 点击: [收藏] [投稿]
//文件上传。Linux+apache+php3/4测试通过。iis测试未通过,win+apache+php未测试  
<?php  
if ($HTTP_POST_VARS["upload"]=="上传"){  
file://这里你可以加上检查文件名,格式,图片尺寸等功能,  
file://$picurl 本地系统的全路径  
file://$picurl_name 上传后的临时文件名  
file://$picurl_size 文件的大小(字节)  
file://$picurl_type 文件的MIME类型  

copy("$picurl","/where/you/want/put/the/uploaded/files/in/$picurl_name");  
exit;  
}  
?>  
<form action="." method="post" enctype="multipart/form-data" name="UL">  
<!--注意:这里必须加上‘enctype="multipart/form-data" ’,否则不会产生上  
传动作-->  
<input type="file" name="picurl" size="15"  
accept="image/x-png,image/gif,image/jpeg">  
<input type="submit" name="upload" value="上传">  
</form> 


 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<



上一篇:在线增减.htpasswd内的用户   下一篇:从C/C++迁移到PHP——判断字符类型的函数

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论
更多相关文章
Power by linux-cn.com 粤ICP备05006655号