okay so i am upload files, they have encrypted names once uploaded, the thing is i want to compress them so when a link is reached it downloads instead of displaying
<?php $fileName = $_FILES["file1"]["name"]; // The file name $fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder $fileType = $_FILES["file1"]["type"]; // The type of file it is $fileSize = $_FILES["file1"]["size"]; // File size in bytes $fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true if (!$fileTmpLoc) { // if file not chosen echo "ERROR: Please browse for a file before clicking the upload button."; exit(); } $servername = "localhost"; $username = "#"; $password = "#"; $dbname = "#"; function generateRandomString($length = 8) { $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; } $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $extension = pathinfo($fileName, PATHINFO_EXTENSION); $string69 = generateRandomString(); $date = date("l") . "_" . date("d/m/Y"); $encyptstring = $string69 . "." . $extension; if(move_uploaded_file($fileTmpLoc, "upload/VEMWdk/$string69.$extension")){ } else { echo "upload failed :( please contact iHaveDeBestName"; } ?> in function move_upload_file instead of having the original '$extention' i would like it to be compressed into a .zip file so it would be like if i uploaded a text file it would save into the upload folder as {randomString}.zip and inside that zip would be the text file.
i have tried other method but all it does is replace files in the zip, i would like to create new zips for each file uploaded
please ignore the sqldB connection, that is going to be used for logging uploads