762
questions
0
votes
1
answer
28
views
PHP: Unable to extact files from a ZIP archive
I am trying to upload a .zip file to a Server and extract it.
First I move the uploaded .zip file to my $target_path
$target_Path = $path . basename($_FILES['file']['name']);
move_uploaded_file($...
0
votes
1
answer
30
views
How to get name of zip file [php] [ziparchive]
Given a ZipArchive, how is it possible to get the name of the file that is opened?
Let's say I have library function (which I can't edit) and it looks like this
function getZipFile(): ZipArchive
{
...
0
votes
0
answers
43
views
Can't open the extracted file using Laravel ZipArchive
In the system, there's a export capability where the user can export multiple files. We decided to put all the multiple files into zip folder.
We used the ZipArchive, so far what we have: export the ...
1
vote
0
answers
25
views
Call fsync on ZipArchive in PHP
Is there anyway to get access to underlying stream used by a ZipArchive in php so that fsync can be called on it?
I am looking to explicitly flush an archive I am creating to NFS to force propagation.
0
votes
2
answers
75
views
Class "ZipArchive" not found in web application [duplicate]
I am facing a strange issue in the interaction between a view and ZipArchive in laravel. I made some test class to test the issue:
<?php
namespace App\Services;
use ZipArchive;
class Test
{
...
0
votes
0
answers
10
views
Problem when retrieving a .cdr archive from my Storage server in Laravel
I'm working with Laravel 10x. When I try to retrieve a .cdr file that I saved on my dedicated storage server, the file gets altered.
I've attempted two methods: using ZipArchive and retrieving the ...
-1
votes
1
answer
84
views
Does ZipArchive::addFile() mess with hrtime()?
I have this loop:
//open archive $zip
$start = hrtime(true);
while(true) {
$zip->addFile($files[$i++]);
$end = hrtime(true);
$time = ($end - $start) / 1e+9; // convert to seconds
if( $time &...
1
vote
2
answers
74
views
Set directory mtime in ZipArchive with PHP 7.4
In PHP 7.4, neither ZipArchive::setMtimeIndex nor ZipArchive::setMtimeName is available.
When creating Zip archives from files in PHP 7.4; files' mtime and permissions are applied to the corresponding ...
0
votes
0
answers
35
views
Is there any file limit in php ZipArchive?
I have the following problem, I have an array with several Amazon S3 links referring to .xml files.
I then pass these files through a forach and place them using php's ZipArchive addFromString.
The ...
1
vote
0
answers
334
views
problem with Warning: PHP Startup: Unable to load dynamic library 'zip'
I´m trying to update my composer in my proyect and command return this message:
PHP Warning: PHP Startup: Unable to load dynamic library 'php_zip.dll' (tried: C:/xampp/php/ext/php_zip.dll (No se ...
1
vote
1
answer
111
views
Php, ZipArchive deletes an empty file?
here is a little code I wrote:
file_put_contents('a.upl', '');
try
{
$x = new \ZipArchive();
$x->open('a.upl');
}
catch(\Exception $e)
{
echo $e->getMessage();
}
it throws a ...
1
vote
2
answers
168
views
PHP unzip deflate64
I am currently facing an issue while trying to decompress a ZIP file that utilizes Deflate64 compression in PHP using the ZipArchive class. The extraction process seems to be working well for regular ...
1
vote
1
answer
166
views
How to enable php-zip in laravel nativephp application
I am using Laravel nativePHP package to generate desktop application
It's running fine but when I try to generate zip file with ZipArchive class, getting this error : Class "ZipArchive" not ...
0
votes
1
answer
101
views
Split zip archive on multiparts based on size with php ZipArhive class [closed]
Problem: Split archive on parts based on parts size with ZipArchive
I have zip archive and I need split it into parts based on part size. Like if I have archive 20 MB, I need split him on archive ...
1
vote
2
answers
186
views
How to add multiple files to ZipArchive in O(n) time [closed]
I am offering a means of downloading multiple photos as a single archive file.
TAR format works fine, but most people don't have anything that can open TAR files on their device, then complain that it ...
0
votes
1
answer
194
views
PHP8 returning ZipArchive getStream from a function makes the containing zip archive to be closed
private function getFilePointer($file)
{
$pathInfo = pathinfo($file);
$zip = new ZipArchive();
if (($res = $zip->open($file)) !== true) {
throw new Exception("error&...
0
votes
1
answer
2k
views
Approaching a Capture the Flag Question involving a text file and a sha256 hash?
I have to complete a capture the flag challenge. I am given a text file named notazipfile.txt containing mostly random characters, as seen at the bottom of the post. I am also given a sha256 hash as ...
0
votes
1
answer
285
views
Laravel PHP create empty new zip archive [duplicate]
I don't understand why every time I run the following script, the zip file will contain all the previous files.
I want to start with an empty archive every time I run the script. How can I do that?
I ...
0
votes
1
answer
37
views
Need the reference for the switch flags used in zip [closed]
Please let me know where I can find where switches (flags) such as -r in the context below can be found.
I treat these things like a foreign language -- get the nit picky things defined so you can ...
0
votes
0
answers
2k
views
Password protected ZIP file - How to bypass the password successfully
I have a zip file which is password protected and in which I dont have any clue at all about the password.
I need to know if anyone of you have recently actually managed to open up a password ...
0
votes
0
answers
52
views
PHP ZipArchive: how to fix inaccurate file dates?
I have a php (7.0.33) script that zips a whole web directory, complete with sub-folders & files.
After downloading and extracting such an archive, I noticed that the file dates from within the zip ...
0
votes
0
answers
66
views
How to set output directory for the created zip archive using PHP ZipArchive class?
I am using PHP ZipArchive class to archive files from different locations. Code is below
php
$files = array('path/1/file1.zip', 'path/2/file2.zip');
$zipname = "path/to/output/archive-" . ...
0
votes
0
answers
439
views
Read zip file on s3 without download or save in Laravel or PHP
I need to get the images file name in a zip file that uploaded to s3 without download or save, is that possible? Currently i'm only able to make it if file are store in local.
here is my code:
$z = ...
0
votes
1
answer
175
views
Laravel download and extract archives
Is there a way to shorten or make it easier to save and decompress an archive in laravel like below?
public function upload(Request $request, string $slug)
{
$request->validate([
...
1
vote
1
answer
319
views
PHP Zip Archive Extract Entire Folder
I am using PHP ZipArchive. Very simple but I am having trouble with extracting an entire folder.
$zip=new \ZipArchive;
$zip->open('zipped.docx');
$zip->extractTo('unzipped/',['word/document.xml',...
0
votes
2
answers
6k
views
Class "ZipArchive" not found in Laravel
Using maatwebsite/excel package to import excel files to the app. CSV imports work properly but when I try importing XLSX(Excel) files, I get this error "Class "ZipArchive" not found&...
1
vote
0
answers
49
views
PHP ZipArchive throwing warning on question mark in filename
ZipArchive is extracting to a windows filesystem, which doesn't like questionmarks in filenames. I'm getting this warning:
Warning: ZipArchive::extractTo(/sharednew/Discworld//56. Assassination? ...
0
votes
0
answers
56
views
Improvement of code performance handling large zip file
I have a code that do exactly what I need. It handle a zip file that contains a repository from gitlab that's about 80mb of size.
In the code I just need to remove the "root path", and put ...
0
votes
1
answer
262
views
Implementing download functionality but getting a 404 error ( laravel )
I am trying to implement download all files functionality in my code. I've referred to some links in stackoverflow to implement this. However, I am still struggling to make this works, below are the ...
0
votes
0
answers
30
views
PHP Script called multiple times whereas URL only called once
I've got a script to backup a directory on a hosted webserver. The directory should be compressed about 1GB.
error_reporting(E_ALL);
ini_set('display_errors', 1);
include 'Archive/Tar.php';
$dir = ...
-1
votes
1
answer
107
views
PHP ZipArchive::addGlobe() is slow I can not delete temp directory
I have a code which
Generate csv files to temp directory
Call ZipArchive::addGlob()
Then remove temp dir
But it seems the addGlobe() is not enough fast and files are deleted before addGlob() creates ...
1
vote
0
answers
225
views
PHP ZipArchive::addGlob() does not work as expected
I have a bunch of large CSV files which need to zip for later exports. I thought it should be easy with ZipArchive class but it is not. My code looks like:
$zip = new ZipArchive();
$open = $zip->...
0
votes
1
answer
56
views
PHP ZipArchive list only one level of files/folders
I have wp.zip and would like to list only one level of files/folders. My current code:
$zip = new \ZipArchive();
$zip->open('wp.zip'), \ZipArchive::RDONLY);
for ($i = 0; $i < $zip->numFiles; ...
1
vote
0
answers
80
views
ZipArchive zip particular folder but not the root folder in Laravel
I am trying to zip all files and folders, and it works fine in local XAMPP, but in Server it only works for the particular given Folder, not the root.
My function for zipping public folder containing ...
1
vote
1
answer
667
views
Is it possible to download a file nested in a zip file, without downloading the entire zip file?
Is it possible to download a file nested in a zip file, without downloading the entire zip archive?
For example from a url that could look like:
https://www.any.com/zipfile.zip?dir1\dir2\...
2
votes
1
answer
259
views
golang archive/zip exclude subfolders?
func main() {
// Open a zip archive for reading.
r, err := zip.OpenReader("e:\\demo.zip")
if err != nil {
log.Fatal(err)
}
defer r.Close()
for _, f := range ...
1
vote
1
answer
271
views
PHP: Unable to extact particular files from a ZIP archive
I am trying to extract files from a zip file, but its failing with following error
Warning: copy(zip://upload/myzip-file.zip#myzip-file/file_001.csv): Failed to open stream: operation failed in {code ...
1
vote
1
answer
910
views
Strange behaviour when try to extract a zip file in docker container with laravel
I'm trying to extract a zip archive in a docker container app running Laravel 9 on PHP 8.1.7, and i'm facing a weird error.
So if a try this code in a controller
$zip = new ZipArchive();
$...
1
vote
0
answers
58
views
PHP ZipArchive | creating unsupported file & not downloading on Cpanel | working on local
hi my goal is to create zip file and download it, working okay on local server but giving problem on Cpanel when i hit download button
$fileEntry = FileEntry::with('childEntriesRecursive')->where('...
0
votes
1
answer
77
views
PHP - bug in time() function when using ZipArchive
I'm using ZipArchive's addEmptyDir/addFile methods to add files to a ZIP file in a loop and measure the current time.
Currently, the relevant part from my code looks like this:
$zip = new ZipArchive();...
0
votes
1
answer
1k
views
PHP ZipArchive gives Invalid or uninitialized Zip object error on extraction
I'm having trouble extracting file some files from zip using ZipArchive
Here is my code
$pp_saved_zip_archive = "$extract_path/archive.zip";
$zip = new ZipArchive;
$res = $zip->open($...
0
votes
1
answer
204
views
PHP Unzip issue ZipArchive extractTo not creating Folders
when i'm extacting a zip-Archive that contains a subfolder with some Images in it, then the directory is not created. Instead the Directory-Name is now part of the filename ?!
This makes no sense to ...
0
votes
0
answers
110
views
Force PHP to read a ZipFile entry with a CRC error
I'm attempting to read a zip file in PHP that I know has a CRC error. Unfortunately, it looks like I can only get 31 bytes of the file to read. Using just $zip->getFromName() gives no errors but ...
0
votes
3
answers
1k
views
Download PHP ZipArchive returns corrupt, blank zip file
I've had a look at various threads about ZipArchive and how to get files to download. However, I've gotten a bit stuck here.
I currently have a form that looks like this
<form name="download-...
0
votes
0
answers
178
views
zip->open not working. Returning 5 (read error)
I am creating a WordPress plugin. I need to open a word document which is already stored on the server.
I have SQL bringing back the location and storing it as $file_loc http://localhost/pjmorris/wp-...
0
votes
1
answer
799
views
How to zip multiple datasets from different folders in one zip file SAS
I have a macro that creates a zip file to archive all datasets from ONE folder. I would also like to also include only a few datasets from a different folder into that same zip file, if possible?
I'm ...
2
votes
1
answer
473
views
Powershell read XML file content in a nested zip file
I'm facing a problem related to nested zip files in powershell.
Currently I have a zip file that contains a second zip file. Inside this second zip file I have a XML file that contains some business ...
0
votes
0
answers
262
views
Php PhpZip error Unexpected end of archive
Am trying to secure files with password before downloading it, but it showing error.
Am using PhpZip
Password Secure Archive
$zipFile = new \PhpZip\ZipFile();
$zipFile->addFile(__DIR__ . "/../...
0
votes
0
answers
951
views
how to store laravel excel in a zip file
I have a class that exports a excel file as a scheduled job:
class exportExcelBasedOnID {
public function __construct(ScheduleJob $scheduleJob) {
$scheduleJob->processed_at = Carbon::now();
...
0
votes
1
answer
100
views
Fetch everything in a folder based on extension and put into zip
I have to make 3 buttons. On button click I want to download all files from selected folder with correct extension in zip file. Eveything on wordpress site. The problem is, zip file is saving as .zip, ...