php多文件上传代码
今天在网上看到一网友写了多文件上传的功能,我现在把它整理一下,呵呵,占点便宜了.
共有三个文件,第一个为html文件,就是上传,第二个是fileclass.php 上传文件的php代码,最后一个是显示index.php文件,这个文件是读取目录里面的文件显示,而不是从数据库读取.
下面来看看html文件代码如下:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>多文件上传学习</title> </head> <body> <h1>多个文件上传</h1> <form action="fileclass.php" enctype="multipart/form-data" method="post" id="userfile"> <table width="350" border="0" cellpadding="0" cellspacing="5"> <tr> <td><input name="userfile[]" type="file" size="30" /></td> </tr> <input type="hidden" name="MAX_FILE_SIZE" value="1000000" /> <tr> <td><input name="userfile[]" type="file" size="30" /></td> </tr> <tr> <td><input name="userfile[]" type="file" size="30" /></td> </tr> <tr> <td><input name="userfile[]" type="file" size="30" /></td> </tr> <tr> <td><input name="userfile[]" type="file" size="30" /></td> </tr> <tr> <td><input name="submitfile" type="submit" value="确认上传文件"/> <input name="resetfile" type="reset" value="取消上传文件"/></td> </tr> </table> </form> </body> </html>
这就是上传文件前面代码了,效果图
文章链接:http://www.phprm.com/develop/c7ce831e51dc23b431959709f1566ec5.html
随便收藏,请保留本文地址!