How to use PHP & Upload and Zip file
How to use PHP & Upload and Zip file This is Learn / tutorial php programming how to using PHP upload and Zip file.
ShotDev Focus:
- PHP & Upload and Zip file.
- PHP & Upload and Zip file.
Example
php_upload_zip1.php
- <html>
- <head>
- <title>ShotDev.Com Tutorial</title>
- </head>
- <body>
- <form action="php_upload_zip2.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="fileUpload1" type="file"><br>
- <input name="fileUpload2" type="file"></td>
- </tr>
- <tr>
- <td> </td>
- <td><input type="submit" name="Submit" value="Upload"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
php_upload_zip2.php
- <html>
- <head>
- <title>ShotDev.Com Tutorial</title>
- </head>
- <body>
- <?
- $ZipName = "myfile/".$_POST["txtZipName"];
- require_once("dZip.inc.php"); // include Class
- $zip = new dZip($ZipName); // New Class
- //*** Files 1 ***/
- if($_FILES["fileUpload1"]["name"] != "")
- {
- $zip->addFile($_FILES["fileUpload1"]["tmp_name"],$_FILES["fileUpload1"]["name"]); // Source,Destination
- }
- //*** Files 2 ***/
- if($_FILES["fileUpload2"]["name"] != "")
- {
- $zip->addFile($_FILES["fileUpload2"]["tmp_name"],$_FILES["fileUpload2"]["name"]); // Source,Destination
- }
- $zip->save();
- echo "Zip Successful Click <a href=$ZipName>here</a> to Download";
- ?>
- </body>
- </html>
Create a php file and save to path root-path/myphp/
Screenshot
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment