2009-09-29 56 views
2

有谁知道一个好的php或ajax多文件上传脚本上传到Web服务器?php多文件上传脚本

这里的区别是,没有任何东西可以在客户端机器上需要即没有闪光!

我想它只是与浏览器合作。

+0

@Adam - 这似乎是http://stackoverflow.com/questions/159600/multiple-file-upload的副本,其中有几个很好的答案。的 – 2009-09-29 15:23:56

+0

可能重复[PHP多文件上传(http://stackoverflow.com/questions/14542068/php-multiple-file-uploads) – e4c5 2015-08-28 05:21:54

+0

这可能是最常见的所有问题上的计算器 – e4c5 2015-08-28 05:22:09

回答

0
+1

感谢您的输入 - 我试过FancyUpload,但它似乎很复杂,很少或根本不支持论坛行动 – 2009-09-29 15:38:21

+0

那么SWFUpload呢?一样? – MaxiWheat 2009-09-29 16:40:23

0

我的plupload支持各种各样的另外的客户端技术(HTML5,闪光灯,Silverlight中,的BrowserPlus,齿轮)的风扇以基本的单个文件html4上传,不像SWFUpload只有flash + html4后备。

它也很好地与jQuery的整合。

1
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> 
<tr> 
<form action="multiple_upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> 
<td> 
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> 
<tr> 
<td><strong>multiple Files Upload </strong></td> 
</tr> 
<tr> 
<td>Select file 
<input name="ufile[]" type="file" id="ufile[]" size="50" /></td> 
</tr> 
<tr> 
<td>Select file 
<input name="ufile[]" type="file" id="ufile[]" size="50" /></td> 
</tr> 
<tr> 
<td>Select file 
<input name="ufile[]" type="file" id="ufile[]" size="50" /></td> 
</tr> 
<tr> 
<td align="center"><input type="submit" name="Submit" value="Upload" /></td> 
</tr> 
</table> 
</td> 
</form> 
</tr> 
</table> 

STEP2:创建文件multiple_upload_ac.php

<?php 

//set where you want to store files 
//in this example we keep file in folder upload 
//$HTTP_POST_FILES['ufile']['name']; = upload file name 
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif 

$path1= "upload/".$HTTP_POST_FILES['ufile']['name'][0]; 
$path2= "upload/".$HTTP_POST_FILES['ufile']['name'][1]; 
$path3= "upload/".$HTTP_POST_FILES['ufile']['name'][2]; 

//copy file to where you want to store file 
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1); 
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2); 
copy($HTTP_POST_FILES['ufile']['tmp_name'][2], $path3); 

//$HTTP_POST_FILES['ufile']['name'] = file name 
//$HTTP_POST_FILES['ufile']['size'] = file size 
//$HTTP_POST_FILES['ufile']['type'] = type of file 
echo "File Name :".$HTTP_POST_FILES['ufile']['name'][0]."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][0]."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][0]."<BR/>"; 
echo "<img src=\"$path1\" width=\"150\" height=\"150\">"; 
echo "<P>"; 

echo "File Name :".$HTTP_POST_FILES['ufile']['name'][1]."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][1]."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][1]."<BR/>"; 
echo "<img src=\"$path2\" width=\"150\" height=\"150\">"; 
echo "<P>"; 

echo "File Name :".$HTTP_POST_FILES['ufile']['name'][2]."<BR/>"; 
echo "File Size :".$HTTP_POST_FILES['ufile']['size'][2]."<BR/>"; 
echo "File Type :".$HTTP_POST_FILES['ufile']['type'][2]."<BR/>"; 
echo "<img src=\"$path3\" width=\"150\" height=\"150\">"; 

/////////////////////////////////////////////////////// 

// Use this code to display the error or success. 

$filesize1=$HTTP_POST_FILES['ufile']['size'][0]; 
$filesize2=$HTTP_POST_FILES['ufile']['size'][1]; 
$filesize3=$HTTP_POST_FILES['ufile']['size'][2]; 

if($filesize1 && $filesize2 && $filesize3 != 0) 
{ 
echo "We have recieved your files"; 
} 

else { 
echo "ERROR....."; 
} 

////////////////////////////////////////////// 

// What files that have a problem? (if found) 

if($filesize1==0) { 
echo "There're something error in your first file"; 
echo "<BR />"; 
} 

if($filesize2==0) { 
echo "There're something error in your second file"; 
echo "<BR />"; 
} 

if($filesize3==0) { 
echo "There're something error in your third file"; 
echo "<BR />"; 
} 
?> 

I found this code in http://www.phpeasystep.com/phptu/2.html 
for more details check <a href="http://www.specialend.com/">Tutorial</a>