Chinaunix首页 | 论坛 | 博客
  • 博客访问: 144593
  • 博文数量: 27
  • 博客积分: 2613
  • 博客等级: 少校
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2004-12-17 13:12
个人简介

No pain, no gain.

文章分类

全部博文(27)

文章存档

2011年(4)

2010年(2)

2009年(2)

2008年(3)

2007年(2)

2006年(4)

2005年(4)

2004年(6)

我的朋友

分类:

2006-05-31 23:38:46

/* written by LiYongQuan */
function
up_file($UploadFile,$UploadPath,$FName,$UploadFile_size,$isover=0,$TimeLimit=60)
  {
    // $UploadFile:  source file
    // $UploadPath: destination path
    // $FName: destination file
    // $UploadFile_size: source file size
    // $isover: if destination is aleady exist, overwrite? 0-No;1-Yes
    //$TimeLimit: set_time_limit=?
    //example:up_file($UploadFile,$dis,$UploadFile_name,$UploadFile_size,0,60);
    set_time_limit($TimeLimit);
    $FileName = AddSlashes($UploadPath).$FName;
    if(($UploadFile =="none") || ($UploadFile == ""))
 {echo("You didn't choice any file!");
  return(1);
 }
    if(($FileName =="none") || ($FileName == ""))
 {echo("You didn't supply destination file!");
  return(2);
 }
    $FileName = AddSlashes($UploadPath).$FName;
    if($UploadFile_size<1024)
       {$FileSize=(string)$UploadFile_size."byte";}
    elseif($UploadFile_size<(1024*1024))
       {$FileSize=number_format((double)($UploadFile_size/1024),1)."KB";}
    else
       {$FileSize=number_format((double)($UploadFile_size/(1024*1024)),1)."MB";}
 
    if(!file_exists($FileName) || $isover)
 {if(copy($UploadFile,$FileName))
     {echo("File1: $FName($FileSize) upload successful!");
      return(0);
     }
  else
     {echo("File: $FName($FileSize) upload failed!");
      return(3);
     }
 }
    else
 if(file_exists($FileName))
      {echo("File: $FName already exist!");
       return(3);
      }
 
    unlink($UploadFile);
    set_time_limit(30);
  }  
?>
阅读(1295) | 评论(0) | 转发(0) |
0

上一篇:sybase dump error.

下一篇:create a "select element"

给主人留下些什么吧!~~