Create zip file php
This is an application type of program you need to create number of files.First you need to upload the files in to a directory which are to be zipped.My example Files have been uploaded to directory created as "files" .I think you may have created multiple files upload php in my previous tutorials. Same scripts have been used in this tutorial also for file uploading.
Following are the multiple files uploading scripts
<html> <head> <title>multiple file upload </title> <script type="text/javascript"> function add_file_field(){ var container=document.getElementById('file_container'); var file_field=document.createElement('input'); file_field.name='images[]'; file_field.type='file'; container.appendChild(file_field); var br_field=document.createElement('br'); container.appendChild(br_field); } </script> </head> <body> <form action="mupload.php" method="post" enctype="multipart/form-data" name="mutiple_file_upload_form" id="mutiple_file_upload_form"> <h3>Multiple File Upload </h3> <div id="file_container"> <input name="images[]" type="file" /> <br /> </div> <a href="javascript:void(0);" onClick="add_file_field();">Add another</a><br /> <input type="submit" name="Submit" value="Submit" /> </form> </body> </html> |
mupload.php
<?php if (isset($_POST['Submit'])) { $number_of_file_fields = 0; $number_of_uploaded_files = 0; $number_of_moved_files = 0; $uploaded_files = array(); $upload_directory = dirname(__file__) . '/files/'; for ($i = 0; $i < count($_FILES['images']['name']); $i++) { $number_of_file_fields++; if ($_FILES['images']['name'][$i] != '') { $number_of_uploaded_files++; $uploaded_files[] = $_FILES['images']['name'][$i]; if (move_uploaded_file($_FILES['images']['tmp_name'][$i], $upload_directory . $_FILES['images']['name'][$i])) { $number_of_moved_files++; } } } header("location: czip.php"); } ?> |
Changes,I have made from previous tutorial on file upload, I have marked in bold blue color.Next you have to create czip.php file as bellow.
Then create empty.php to make your folder empty.
<?PHP function empty_folder($folder, $debug = false){ if ($debug) { header("location: czip.php"); } $d = dir($folder); while (false !== ($entry = $d->read())) { $isdir = is_dir($folder."/".$entry); if (!$isdir and $entry!="." and $entry!="..") { unlink($folder."/".$entry); } elseif ($isdir and $entry!="." and $entry!="..") { empty_folder($folder."/".$entry,$debug); rmdir($folder."/".$entry); } } $d->close(); } empty_folder("files",true); ?> |
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
İKL8S5
Hollanda yurtdışı kargo
ReplyDeleteİrlanda yurtdışı kargo
İspanya yurtdışı kargo
İtalya yurtdışı kargo
Letonya yurtdışı kargo
HCOGMP
Litvanya yurtdışı kargo
ReplyDeleteLüksemburg yurtdışı kargo
Macaristan yurtdışı kargo
Malta yurtdışı kargo
Polonya yurtdışı kargo
L3Y
Yunanistan yurtdışı kargo
ReplyDeleteAfganistan yurtdışı kargo
Amerika Birleşik Devletleri yurtdışı kargo
Amerika Samoası yurtdışı kargo
Angola yurtdışı kargo
ZZ4CW