<html> <head> <title>ThaiCreate.Com PHP Zip</title> </head> <body> <form action="phpMultipleUploadZip.php" method="post" enctype="multipart/form-data" name="frmMain"> <table width="343" border="1"> <tr> <td>Zip Name</td> <td><input name="txtZipName" type="text"></td> </tr> <tr> <td>Files</td> <td> <input name="fileUpload[]" type="file"><br> <input name="fileUpload[]" type="file"><br> <input name="fileUpload[]" type="file"><br> <input name="fileUpload[]" type="file"><br> <input name="fileUpload[]" type="file"><br> <input name="fileUpload[]" type="file"><br></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Upload"></td> </tr> </table> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP Zip</title> </head> <body> <?php $ZipName = "MyFiles/".$_POST["txtZipName"]; require_once("dZip.inc.php"); // include Class $zip = new dZip($ZipName); // New Class //*** Zip Files ***/ for($i=0;$i<count($_FILES["fileUpload"]["name"]);$i++) { if($_FILES["fileUpload"]["name"][$i] != "") { $zip->addFile($_FILES["fileUpload"]["tmp_name"][$i],$_FILES["fileUpload"]["name"][$i]); // Source,Destination } } $zip->save(); echo "Zip Successful Click <a href=$ZipName>here</a> to Download"; ?> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท