jeudi 26 mars 2015

uploading multiple files and zip them in a folder in the server


Vote count:

0




This is the code am using to upload file and then it seam not to work. i have tried forcing it to download and i get a blank zip file which when i extract, i get a .cpgz file.


The zip file seam to be created but the uploaded files are not getting inside the zip file



<?php
if(isset($_POST['createpdf']))
{

$file_folder = "files/"; // folder to load files
$zip = new ZipArchive(); // Load zip library
$zip_name = "upload/".time().".zip"; // Zip name
if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE){
// Opening zip file to load files
$error .= "* Sorry ZIP creation failed at this time<br/>";
}
foreach($_FILES as $filesuploaded){
$fname = $filesuploaded['name'];
$ftype = $filesuploaded['type'];
$ftmpname = $filesuploaded['tmp_name'];
$zip->addFile($ftmpname);
}
$zip->close();

}


?>



asked 2 mins ago







uploading multiple files and zip them in a folder in the server

Aucun commentaire:

Enregistrer un commentaire