Zip File Converter





the only images will be compressed from this converter other large file be be generate error.

<!DOCTYPE html>
<html>
<head>
    <title>Zip File Create</title>
</head>
<body>

    <h1> Create Zip file </h1>
    
    <form method="post" enctype="multipart/form-data">
        <?php

            if(isset($_FILES['file'])){
                $file_name = $_FILES['file']['name'];
                $file_tmp = $_FILES['file']['tmp_name'];
                $random_name = rand();
                $file_type = explode('.',$file_name);
                $file_type = end($file_type);
                $error = $_FILES['file']['error'];

                if($error == 0){
                    $upload = move_uploaded_file($file_tmp, 'upload/'.$random_name.'.'.$file_type);
                    if($upload){
                        if(extension_loaded('zip')){
                            $zip = new zipArchive();
                            $zip_name = $random_name.'.zip';
                            if($zip->open($zip_name, ZIPARCHIVE::CREATE) == TRUE){
                                $zip->addfile('upload/'.$random_name.'.'.$file_type, $random_name. '.'.$file_type);
                                $zip->close();
                                $message = "compressed";
                            } else {
                                $message = "There was some error in create the zip file !";
                            }
                        } else {
                            $message = "you can't compress this file , this is zip extension file !";
                        }
                    } else {
                        $message = "There was some error in uploading the file !";
                    }
                }else{
                    $message = "Some error in the file";
                }
                echo '<p>'.$message.'</p>';
            }

        ?>

        Choose File: <input type="file" name="file" />
                     <input type="submit" value="Create Zip File">
    </form>

</body>
</html>

Rules to download the file :


1) Enter Your name.


2) Click any ads in the website and copy the path of the advertisement .


3) Now paste it path of the advertisement in the form


4) Enter Your email id.


5) Now last step click on the download button and Your File Download will be started.