All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP实例:PHP无限极分类_[PHP教程]
js关于document和window对象_JavaScript技术_编程技术
让PHP支持断点续传文件_[PHP教程]
visual c++中CFontDialog对话框
ASP.NET,MVC框架(第一部分)_[Asp.Net教程]
解决SQL Server 2000中讨厌的Bug_[SQL Server教程]
Javscript实现表单复选框的全选功能_JavaScript技术_编程技术
Delphi函数中参数的使用实例-方法
利用正则表达式去掉html代码_.net资料_编程技术
.net(C#)开发小技巧漫谈之三:关于在Web开发中绑定数据的三种方法_[Asp.Net教程]
Reading number is top 10 pictures
The money of more than 100 countries and regions7
The money of more than 100 countries and regions9
So beauty, will let you spray blood5
Chinese paper-cut grilles art appreciation8
A man's favorite things5
BingBingFan apple dew point photo gallery2
中国文革时期的色情图片2
29 the belle stars after bath figure1
Photographed the passion of the clients and prostitutes in the sex trade picture2
The sixties of the last century, China is such a kill pig
Download software ranking
艳兽都市
XML+Web+Service开发教程
SP4 for SQL2000
I'm come from Beijing1
Detective task-the top secret prostitution files
jdk1.5
星际争霸1.08硬盘免安装版
Eclipse 4.2.2 For Win64
WebService在.NET中的实战应用教学视频 → 第5集
Tram sex maniac 2 (H) rar bag16
aaa published in(发表于) 2013/12/21 22:24:47 Edit(编辑)
php上传文件功能函数_php资料_编程技术

php上传文件功能函数_php资料_编程技术

php上传文件功能函数_php资料_编程技术-你的首页-uuhomepage.com
/*****************************************
Title :文件上传详解
Author:leehui1983(辉老大)
Finish Date :2006-12-28
*****************************************/
$uploaddir = "./files/";//设置文件保存目录 注意包含/
$type=array("jpg","gif","bmp","jpeg","png");//设置允许上传文件的类型
$patch="http://127.0.0.1/cr_downloadphp/upload/files/";//程序所在路径
//获取文件后缀名函数
function fileext($filename)
{
return substr(strrchr($filename, '.'), 1);
}
//生成随机文件名函数
function random($length)
{
$hash = 'CR-';
$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
$a=strtolower(fileext($_FILES['file']['name']));
//判断文件类型
if(!in_array(strtolower(fileext($_FILES['file']['name'])),$type))
{
$text=implode(",",$type);
echo "您只能上传以下类型文件: ",$text,"
";
}
//生成目标文件的文件名
else{
$filename=explode(".",$_FILES['file']['name']);
do
{
$filename[0]=random(10); //设置随机数长度
$name=implode(".",$filename);
//$name1=$name.".Mcncc";
$uploadfile=$uploaddir.$name;
}
while(file_exists($uploadfile));
if (move_uploaded_file($_FILES['file']['tmp_name'],$uploadfile)){
if(is_uploaded_file($_FILES['file']['tmp_name'])){
//输出图片预览
echo "
您的文件已经上传完毕 上传图片预览:

";
echo"
继续上传
";
}
else{
echo "上传失败!";
}
}
}
?>



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.