|
发表于 2006 年 7 月 6 日 22:02:39
|
显示全部楼层
- <?php
- set_time_limit(0);
- $dir=dirname(__FILE__);
- if($_POST['submit']){
- foreach ($_FILES['upfile']['tmp_name'] as $k=>$v){
- !$v || (!file_exists($dir.'/pic/'.$_FILES['upfile']['name'][$k]) && @getimagesize($v) && @move_uploaded_file($v,$dir.'/pic/'.$_FILES['upfile']['name'][$k]) && print ('上传'.$_FILES['upfile']['name'][$k].'成功<br />') )|| print ('上传'.$_FILES['upfile']['name'][$k].'失败<br />');
- }
- die("<meta http-equiv="refresh" content="1;URL=./up.php">");
- }
- ?>
- <html>
- <head>
- <title>UP~~~up~~~UP~~up~~~小白木JJ~~~~~~~~~</title>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
- <style type="text/css">body,td{font-family:tahoma,verdana,arial;font-size:11px;line-height:15px;background-color:white;color:#666666;margin-left:20px;}
- strong{font-size:12px;}
- a:link{color:#0066CC;}
- a:hover{color:#FF6600;}
- a:visited{color:#003366;}
- a:active{color:#9DCC00;}
- table.itable{}
- td.irows{height:20px;background:url("index.php?i=dots") repeat-x bottom}</style>
- <script language="JavaScript">
- function addupload() {
- document.all.upload.innerHTML = '<input name="upfile[]" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="25"><br /><input name="upfile[]" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="25"><br />'+document.all.upload.innerHTML;
- }
- </script>
- </head>
- <body>
- <center><form enctype="multipart/form-data" method="post" name="upform">
- 上传文件: <br><br>
- <a href='#' onClick="addupload()">增加上传文件</a><br><br>
- <input name="upfile[]" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="25"><br>
- <input name="upfile[]" type="file" style="width:200;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="25"><br>
- <div id="upload"></div>
- <input type="submit" name="submit" value="上传" style="width:30;border:1 solid #9a9999; font-size:9pt; background-color:#ffffff" size="25"><br><br><br>
- <br><br>
- <a href="index.php">返回</a><br />
- </form>
- </center>
- </body>
- </html>
复制代码
建个pic目录,权限0777继承,这个是up.php
[ 本帖最后由 winsock 于 2006-7-6 22:04 编辑 ] |
|