一个文件域实现多文件的上传<二>

来源:互联网 发布:数控折弯机怎样编程 编辑:程序博客网 时间:2024/06/05 11:23

一个文件域实现多文件的上传:

表单页面:

<!DOCTYPE html>  <html>      <head>          <meta charset="UTF-8"/>          <title>多文件上传</title>      </head>      <body> 
<span style="white-space:pre"><form action="file.php" method="post" enctype="multipart/form-data"></span>                     <input type="file" name="files[]" multiple="" />             <input type="submit" value="提交">        </form>                </body>  </html>  
php页面:file.php

<?php<span style="white-space:pre"></span>
<span style="white-space:pre"></span>/*循环输出图片的路径并实现添加*/for($i=0;$i<count($_FILES['files']['name']);$i++){$path = "./file/".$_FILES['files']['name'][$i]; // 文件上传的位置move_uploaded_file($_FILES['files']['tmp_name'][$i], $path);}
?>

0 0
原创粉丝点击