php多文件上传

来源:互联网 发布:mac铁锈红怎么样 编辑:程序博客网 时间:2024/05/01 02:43

1.表单页面代码:

<form enctype="multipart/form-data">
    <table>
        <tr>
            <td>文件</td>
            <td>
                <input type="file" id="file" name="files" multiple="true"/>
            </td>
        </tr>
        <tr>
            <td>
            <input type="button" onclick="fun1()" value="多文件上传" />
            </td>
        </tr>
    </table>
</form>

2.php页面代码:

    <?php       
    for($i=0;$i<count($_FILES["file"]['name']);$i++){  
    $name=$_FILES["file"]["name"][$i];
    $path='images/'.$name;  
    move_uploaded_file($_FILES["file"]["tmp_name"][$i],iconv("UTF-8","gb2312",$path));  
    }  
      
    ?> 

0 0
原创粉丝点击