ziparchive

ZipArchive - addFile won't work

冷暖自知 提交于 2019-12-11 03:47:03
问题 Situation I have a .zip file. In this .zip is a folder "dist/", in the folder "dist/" are 2 things: 1) another folder "lib/" 2) a jar-file I open the .zip and extract the dist/jar-file. A "new" folder will appear on my disk "dist" with the jar in it I open the jar-file with ZipArchive and edit this where needed. Edits are saved by addFromString() Now comes the crucial part I want to re-add the jar-file into the .zip I do this by doing $zip->addFile($newdir . 'dist/' . $corefile, 'dist/' .

ZipArchive returning Empty Folder C#

走远了吗. 提交于 2019-12-11 02:24:29
问题 I am using ZipArchive to create a zipped folder for a list of documents. I cant figure out why, when I return my archived folder it is empty. Does anyone see what I am doing wrong here? My code is as follows: if (files.Count > 1) { var ms = new MemoryStream(); var zipArchive = new ZipArchive(ms, ZipArchiveMode.Create, false); foreach (var file in files) { var entry = zipArchive.CreateEntry(file.UploadFileName, CompressionLevel.Fastest); using (var streamWriter = new StreamWriter(entry.Open())

Use MemoryStream and ZipArchive to return zip file to client in asp.net web api

大兔子大兔子 提交于 2019-12-10 13:38:09
问题 I am trying to return zip file from asp.net web api to client using The following Code: private byte[] CreateZip(string data) { using (var ms = new MemoryStream()) { using (var ar = new ZipArchive(ms, ZipArchiveMode.Create, true)) { var file = archive.CreateEntry("file.html"); using (var entryStream = file.Open()) using (var sw = new StreamWriter(entryStream)) { sw .Write(value); } } return memoryStream.ToArray(); } } public HttpResponseMessage Post([FromBody] string data) {

ZIP file not being created, but no error gets triggered

老子叫甜甜 提交于 2019-12-10 03:15:07
问题 I'm using ZipArchive: function zip_dir($source, $target){ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); $zip = new \ZipArchive(); if($zip->open($target, \ZipArchive::CREATE) !== true) exit('cannot create zip'); foreach($iterator as $file){ $zip->addFile($file); print $file . '<br>'; } $zip->close(); return $target; } zip_dir(__DIR__ . '/test/', __DIR__ . '/testarchive.zip'); I can

NSOpenPanel get filename in Objective-C?

。_饼干妹妹 提交于 2019-12-09 23:33:51
问题 When I create an NSOpenPanel, like this: int i; NSOpenPanel* openDlg = [NSOpenPanel openPanel]; [openDlg setCanChooseFiles:YES]; [openDlg setCanChooseDirectories:YES]; if ([openDlg runModalForDirectory:nil file:nil] == NSOKButton) { NSArray* files = [openDlg filenames]; for( i = 0; i < [files count]; i++ ) { NSString* fileName = [files objectAtIndex:i]; NSLog(fileName); NSString *catched = fileName; [self performSelector:@selector(decompresss2z:) withObject:catched]; } } And when I log

Force download multiple blob files in php

时光总嘲笑我的痴心妄想 提交于 2019-12-08 07:04:37
问题 I want to add a method to my platform that allows users to download all the files from an application, that will be zipped-up. Each application consists of multiple files that are stored in separate rows of the files-table in the database. I tried many options, but just can't seem to add the actual files to the zip. This is my code so far: $sql = "SELECT * FROM files WHERE applications_id = :applications_id"; $stmt = $db->prepare($sql); $stmt->bindParam(':applications_id', $applications_id,

Couldn't load TextureAtlas from zip archive via AssetManager - libgdx

喜欢而已 提交于 2019-12-08 04:32:33
问题 I have 2 instances of AssetManager: one for basic textures and one for high quality textures. Basic textures are located in "android/assets" folder and high quality textures are packed in zip file. Content (file names) in this folders are the same - there are only better quality textures in zip archive. AssetManager throws an exception: "Couldn't load dependencies of asset: teamLogo.png" when I'm trying to load TextureAtlas from zip file. When I'm loading Texture file everything is ok.

zipArchive unzip to document folder on iOS

孤街醉人 提交于 2019-12-08 01:40:55
问题 I'm using ZipArchive to unzip but its unzipping the contents of the zip to a subdirectory of my documents named after the zip file instead of directly into my documents folder. Does anyone know what I can change to make sure its saves to the directory that I want? -(void) unZipUpdateArchiveAtPath: (NSString *)zipPath { NSLog(@"UNZIP Update PATH: %@", zipPath); ZipArchive *zipArchive = [[ZipArchive alloc] init]; if ([zipArchive UnzipOpenFile:zipPath]) { if ([zipArchive UnzipFileTo:[self

Google app engine php zip extension

血红的双手。 提交于 2019-12-07 15:53:52
问题 I am using Google app engine and I want to create a zip archive using the zip extension which is supported in the current version. The problem is that every time i call ZipArchive::close it returns false and ZipArchive::getStatusString returns "Failure to create temporary file: Read-only file system". I am creating the zip file in the cloud storage like this: $zip = new ZipArchive(); $zip->open("gs://whatever/somethig.zip", ZipArchive::OVERWRITE); //returns true $zip->addFromString('file.txt'

ZipArchive Library Is Not Enabled When Using PHPExcel

廉价感情. 提交于 2019-12-07 04:20:29
问题 I am using CodeIgniter and PHPExcel to read and write to excel files. Everything worked fine in localhost, but when I uploaded my PHP CodeIgniter application to the server in pagodabox I got the below message when I tried to read data from excel files. Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library is not enabled' in /var/www/application/libraries/PHPExcel/Reader/Excel2007.php 回答1: For writing, PHPExcel does provide PCLZip as an alternative to ZipArchive. You can