Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > PHP > 上传图片
【标  题】:上传图片
【关键字】:
【来  源】:http://www.cublog.cn/u/19054/showart.php?id=166745

上传图片

Your Ad Here

<form enctype="multipart/form-data" name="cpform" method="post">
<input type="hidden" name="do" value="add" />
<br />
<table cellpadding="4" cellspacing="0" border="0" align="center" width="90%">
<tr >
<td>图片文件</td>
<td><input type=file  name=imgfile>
</td>
</tr>
</table>
<br />
<table cellpadding="4" cellspacing="0" border="0" align="center" width="90%" class="tborder">
<tr>
 <td class="tfoot" colspan="2" align="center"> <input type="submit" class="button" tabindex="1" value="  确定  " accesskey="s" />
 <input type="reset" class="button" tabindex="1" value="  重置  " accesskey="r" />
</td>
</tr>
</table>
</form>
<?php
if ($_POST['do'] == 'add')
{  
 $targetFileName = md5(uniqid(microtime(),1));//$token = md5(uniqid(rand()));
//另外一种随机数唯一值算法

 if(is_uploaded_file($_FILES["imgfile"]["tmp_name"]))
 {
  if(move_uploaded_file($_FILES["imgfile"]["tmp_name"],'./img/'."$targetFileName"))
  echo '上传图片成功,请';
 
 }
 else
 {
  echo "上传" . $_FILES["imgfile"]["name"] . "失败!!<br>";
 }
}
?>

一种权限控制的实现思想:【上一篇】
Regular Expression HOWTO:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 病毒 IRC波特变种ER(Backdoor.IRCBot.er)
  • 网站漏洞百出 QQ密码“大白天下”
  • Windows 2000 自定义桌面图标
  • O'Reilly article :Languages used in Ajax development: the most - Java, the least - Ruby
  • Visual C#托管Socket的实现方法(一) (1)
  • WawaCRM重新启动,欢迎对开源和CRM感兴趣的朋友加入by蛙蛙
  • 在Recordset对象中查询记录的方法
  • MonthPanel 公历、农历控件 (源码)
  • [VBA]删除表中所有含"0"的列,行;指定行,列...
  • Nero 6带给我们的惊喜
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.