I Was Not Able To Upload And Unzip Files

I am trying to upload file in filemanager but it stuck at half even size of zip is below 10MB

  1. I choose option to upload and unzip(ZIP file size 26KB)

  2. Also I tried to upload zip file(ZIP file size 26KB) but zip file dose not extracted it shows only loading icon.

unfortunately there seems to be some issue with unzip in ftp, but there is a fix for this, follow there steps:

  1. just upload file.zip (don’t use upload and unzip)
  2. make un.php file in the same directory as that of zip uploaded.
  3. copy the below code to un.php
<?php
$zip = new ZipArchive;
if ($zip->open('file.zip') === TRUE) {
	$zip->extractTo('./');
	$zip->close();
	echo 'Unzipped Process Successful!';
} else {
	echo 'Unzipped Process failed';
}
?>

  1. Now https://your-website.com/un.zip
  2. This will unzip content of your zip.
1 Like

Okay Thanks I Am Trying It If It Not Works I Will Revert

sure, it will do the job, do not worry.

Easier way would be to just extract the files locally and upload with a desktop FTP client like FileZilla.

7 Likes

Thanks & I will try this next time

Thanks It’s working and I would like to update this code

<?php

//For Multiple Files
$zipFiles = ['libs.zip', 'another.zip', 'build.zip']; 

foreach ($zipFiles as $zipFile) {
    $zip = new ZipArchive;
    
    if ($zip->open($zipFile) === TRUE) {
        $zip->extractTo('./');
        $zip->close();
        echo "Unzipped $zipFile Successful!<br>";
    } else {
        echo "Unzipped $zipFile failed<br>";
    }
}

//For Files From Hidden Folder
$zipFiles = ['plugins/plugins_fastclick.zip', 'plugins/plugins_icheck.zip', 'plugins/plugins_jszip.zip', 'plugins/plugins_pace.zip',]; 

$destinationDirectory = 'plugins/'; 
foreach ($zipFiles as $zipFile) {
    $zip = new ZipArchive;

    if ($zip->open($zipFile) === TRUE) {
        $zip->extractTo($destinationDirectory);
        $zip->close();
        echo "Unzipped $zipFile Successful!<br>";
    } else {
        echo "Unzipped $zipFile failed<br>";
    }
}

?>
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.