| 订阅 | 在线投稿
分享
 
 
 

实现文件上传的程序源码

2008-12-28 07:39:23 编辑來源:互联网 国际版 评论
 
 
本文为【实现文件上传的程序源码】的汉字拼音对照版显示拼音
  <HTML>

  <HEAD>

  <TITLE>wenjianshangchuanjiemian</TITLE>

  </HEAD>

  <BODY><TABLE><CENTER>

  <?

  if($UploadAction){

  $UploadAction=0;

  $TimeLimit=60;

  /*shezhichaoshixianzhishijianmorenshijianwei 30sshezhiwei0shiweibuxianshi */

  set_time_limit($TimeLimit);

  If(($Upfile != "none")&&

  ($Upfile != ""))

  {

  $Filepath="d:\web\web\php\test"; //shangzaiwenjiancunfanglujing

  $FileName=$Filepath.$Upfile_name;

  if($Upfile_size <1024) //shangzaiwenjiandaxiao

  {$FileSize = (string)$Upfile_size . "zijie";}

  elseif($Upfile_size <(1024 * 1024))

  {

  $FileSize = number_format((double)($Upfile_size / 1024), 1) . " KB";

  }

  else

  {

  $FileSize = number_format((double)($Upfile_size/(1024*1024)),1)."MB";

  }

  if(!file_exists($FileName))

  {

  if(copy($Upfile,$FileName))

  {unlink($Upfile);

  echo "<br><br>\n";

  echo "wenjian $Upfile_name yishangzaichenggong";

  echo "<br><br>\n";

  echo "wenjianweizhi$FileName";

  echo "<br><br>\n";

  echo "wenjiandaxiao$FileSize";

  echo "<br><br>\n";

  }

  else

  {echo "wenjian $Upfile_nameshangzaishibai"; }

  }

  else

  {echo "wenjian $Upfile_nameyijingcunzai"; }

  }

  else

  {echo "nimeiyouxuanzerenhewenjianshangzai"; }

  set_time_limit(30); //huifumorenchaoshishezhi

  }

  ?>

  <FORM ENCTYPE = "multipart/form-data" NAME = "SubmitForm"

  ACTION = "default.php" METHOD = "POST">

  <INPUT TYPE = "hidden" NAME = "MAX_FILE_SIZE" VALUE ="1000000">

  <INPUT TYPE = "hidden" NAME = "UploadAction" VALUE = "1">

  <TR><TD><INPUT NAME = "Upfile" TYPE = "file" SIZE = "30"></TD>

  </TR><TR><TD><INPUT NAME = "submit" VALUE = "tijiao" TYPE = "submit">

  <INPUT NAME = "reset" VALUE = "chongzhi" TYPE = "reset"></TD>

  </TR></FORM></CENTER></TABLE>

  </BODY>

  </HTML>原文
 
 
<HTML> <HEAD> <TITLE>文件上传界面</TITLE> </HEAD> <BODY><TABLE><CENTER> <? if($UploadAction){ $UploadAction=0; $TimeLimit=60; /*设置超时限制时间默认时间为 30s,设置为0时为不限时 */ set_time_limit($TimeLimit); If(($Upfile != "none")&& ($Upfile != "")) { $Filepath="d:\web\web\php\test"; //上载文件存放路径 $FileName=$Filepath.$Upfile_name; if($Upfile_size <1024) //上载文件大小 {$FileSize = (string)$Upfile_size . "字节";} elseif($Upfile_size <(1024 * 1024)) { $FileSize = number_format((double)($Upfile_size / 1024), 1) . " KB"; } else { $FileSize = number_format((double)($Upfile_size/(1024*1024)),1)."MB"; } if(!file_exists($FileName)) { if(copy($Upfile,$FileName)) {unlink($Upfile); echo "<br><br>\n"; echo "文件 $Upfile_name 已上载成功!"; echo "<br><br>\n"; echo "文件位置:$FileName"; echo "<br><br>\n"; echo "文件大小:$FileSize"; echo "<br><br>\n"; } else {echo "文件 $Upfile_name上载失败!"; } } else {echo "文件 $Upfile_name已经存在!"; } } else {echo "你没有选择任何文件上载!"; } set_time_limit(30); //恢复默认超时设置 } ?> <FORM ENCTYPE = "multipart/form-data" NAME = "SubmitForm" ACTION = "default.php" METHOD = "POST"> <INPUT TYPE = "hidden" NAME = "MAX_FILE_SIZE" VALUE ="1000000"> <INPUT TYPE = "hidden" NAME = "UploadAction" VALUE = "1"> <TR><TD><INPUT NAME = "Upfile" TYPE = "file" SIZE = "30"></TD> </TR><TR><TD><INPUT NAME = "submit" VALUE = "提交" TYPE = "submit"> <INPUT NAME = "reset" VALUE = "重置" TYPE = "reset"></TD> </TR></FORM></CENTER></TABLE> </BODY> </HTML>
󰈣󰈤
 
 
>>返回首页<<
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 
 热帖排行
 
 
王朝网络微信公众号
微信扫码关注本站公众号wangchaonetcn
 
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
©2005- 王朝网络 版权所有