Hi guys. I'm trying to make a file upload script. It does work to a certain degree. A user uploads a file and it stores in a folder called /uploads/ I need the script to then convert the uploaded file to a .zip and then give the user the download url. If you could tell me where I'm going wrong and give me the correct code, I will be very, very grateful! Here is the error I'm getting now: Fatal error: Class 'ZipArchive' not found in /home/fileflam/public_html/uploader.php on line 29 The website is www.fileflamingo.com Thanks! <?PHP $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); $_FILES['uploadedfile']['tmp_name']; $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } // Create the md5 hash for naming purposes; $zipname = md5($somename_probably_user_provided); // create object $zip = new ZipArchive(); // open archive if ($zip->open($zipname, ZIPARCHIVE::CREATE) !== TRUE) { die ("Could not open archive"); } // list of files to add // list of files to add $fileList = array( 'fstab2.php', 'images/branch.gif', 'files/php1.php' ); // add files foreach ($fileList as $f) { $zip->addFile($f) or die ("ERROR: Could not add file: $f"); } // close and save archive $zip->close(); echo "Archive created successfully."; ?> PHP:
First error is here: $zip = new ZipArchive(); PHP: This means that this extension for PHP is not installed