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

Reading number is top 10 articles
轻松三步走!防止SQL数据库注入攻击_[SQL,Server教程]
用C#访问ACCESS数据库问题_.net资料_编程技术
40种网页常用小技巧_[Html教程]
PHP进阶教程:实现网站的无限分类_php资料_编程技术
好文分享:PHP入门的学习方法_php资料_编程技术
微软新版开发工具VS,2008,beta2功能定案_.net资料_编程技术
网站的ALEXA排名下降的原因及解决方法_JavaScript技术_编程技术
二十 控制表格 Mastering Tables _[Html教程]
轻松掌握Ajax.net系列教程三:使用CascadingDropDown组件_[Asp.Net教程]
怎样才能成为PHP高手学会懒惰的编程_[PHP教程]
Reading number is top 10 pictures
支持判处贩卖儿童者死刑
29 the belle stars after bath figure4
西方气质的东方美女1
The money of more than 100 countries and regions8
Absolutely shocked. National geographic 50 animal photographys1
The goddess of the single reason2
看看什么叫美景
Valentine's day comes, send some cartoon
西方气质的东方美女2
Female model behind the bitterness, often being overcharged5
Download software ranking
Ashlynn Video5
Sora aoi, the maid, students' uniforms
Unix video tutorial8
Boxer vs Yellow2
Boxer Classic video2
Tram sex maniac 2 (H) rar bag6
Unix video tutorial3
Ashlynn Video3
Boxer vs Yellow1
WebService在.NET中的实战应用教学视频 → 第1集
归海一刀 published in(发表于) 2014/2/17 7:46:39 Edit(编辑)
经典php实现大文件上传源代码_[PHP教程]

经典php实现大文件上传源代码_[PHP教程]

经典php实现大文件上传源代码_[PHP教程]
一个比较经典的php大文件上传源代码,可成功运行.


function function_upload($name,$newname="",$dir="upload")
{
global $_FILES,$ext;

$return="";

$time=time();

$upload=trim($_FILES[$name][’tmp_name’]);

$upload_name=trim($_FILES[$name][’name’]);

$size=trim($_FILES[$name][’size’]);

if(empty($upload) or empty($upload_name) or $size==0)
{
return $return;
}

$dir.="/".date("Y-m",$time);

if (is_uploaded_file($upload))
{
$ext=file_extension($upload_name);

if(liu_mkdir($dir))
{

if($newname!="")
{

$newname.=".".$ext;
//$newname=TIME_NOW.".".$ext;
}else{
//$newname=$upload_name;
$newname=$time.".".$ext;
}

if(move_uploaded_file($upload,$dir."/".$newname) and file_exists($dir."/".$newname))
{
chmod($dir."/".$newname,0755);
$return=$dir."/".$newname;
}
}

}

return $return;

}

function file_extension($filename)
{
return substr(strrchr($filename, ’.’), 1);
}

function liu_mkdir($dir,$mode=0777)
{
if(is_dir($dir))
{

if(!is_writable($dir))
{

@chmod($dir,$mode);

}
return true;
}
else

{

$oldmask = @umask(0);

$partialpath = dirname($dir);

if(!liu_mkdir($partialpath,$mode))
{

return false;

}
else

{
return mkdir($dir,$mode);
}

}
}



添加到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.