ziparchive

PHP: generated zip has chmod 644

爷,独闯天下 提交于 2019-12-25 06:53:17
问题 I'm using ZipArchive to create Zips and then provide them to download. I save them in a folder and I want to delete all every night (my cronjob would do that). But now I've seen that they are created using CHMOD 644, and if I try to delete them with my script, I always can't delete them because I do not have sufficient rights. How can I declare that every new Zip which is created uses 777? Thanks for help! Flo 回答1: Are you able to chmod it like so? chmod("/somedir/somefile", 0777); 回答2: The

Offset to Central Directory cannot be held in an Int64 .net core

不羁岁月 提交于 2019-12-25 02:46:10
问题 I am getting "Offset to Central Directory cannot be held in an Int64" exception while using ZipArchive in .NET CORE. NOTE: I am not getting it in my developement machine (Windows 7), but getting it in production server. (Windows Server 2016). Please help. Thanks, Kannan. 回答1: This is because Aws API Gateway. Sorry for not mentioning it. If i skip API Gateway and hit my endpoint through the load balancer i can send the zip files without any issues. 来源: https://stackoverflow.com/questions

Self extracting archive (EXE) for Windows

青春壹個敷衍的年華 提交于 2019-12-24 07:59:08
问题 I'm looking for an easy way to create a self extracting archive (EXE) on Microsoft Windows platforms. I know that there is a built-in tool IExpress.exe , but that has a wizard style UI and I need a "silent" tool, which can be called by scripts. It should be: Scriptable (Windows shell script or Ant build file) Free for commercial use Optionally unpack in a temporary folder or ask the user where to put the unpacked files Nice to have: Auto launch an executable in the archive after unpack No

Using ZipArchive with ASP.NET Core Web Api

*爱你&永不变心* 提交于 2019-12-24 02:37:10
问题 The question is how can I create a zipped (compressed) folder on the fly using ASP.NET Core 2 (currently) Web API? I am using System.IO.Compression.ZipArchive I have been several blog posts where this is done using streams or byte arrays, all give me the same output. I am able to download the zip folder but unable to open it. The zipped folder is the correct size. Even though it doesn't open. They way I want it to work is for a user to click a button which runs this action and return a zipped

Size limit on PHP's zipArchive class?

可紊 提交于 2019-12-24 00:19:00
问题 I'm creating a zip file in PHP for the user to download. I get no errors from PHP or from checking the zipArchive class's GetStatusString function. But if I put some files into the archive, then when I try to open it, I get the error "the compressed (zipped) folder is invalid or corrupted". I've checked all the files I'm adding, they are all good. The only thing I can think of is that the larger files are causing problems. But the "large" file is only about half a megabyte, and I can't find

Extract ZipFile using Python, display Progress Percentage?

安稳与你 提交于 2019-12-23 08:26:48
问题 I know how to extract a zip archive using Python, but how exactly do I display the progress of that extraction in a percentage? 回答1: the extract method doesn't provide a call back for this so one would have to use getinfo to get the e uncompressed size and then open the file read from it in blocks and write it to the place you want the file to go and update the percentage one would also have to restore the mtime if that is wanted an example: import zipfile z = zipfile.ZipFile(some_source)

ZipArchives stores absolute paths

血红的双手。 提交于 2019-12-22 09:05:56
问题 Can I zip files using relative paths? For example: $zip->addFile('c:/wamp/www/foo/file.txt'); the ZIP should have a directory structure like: foo -> file.txt and not: wamp -> www -> foo -> file.txt like it is by default... ps: my full code is here (I'm using ZipArchive to compress contents of a directory into a zip file) 回答1: See the addFile() function definition, you can override the archive filename: $zip->addFile('/path/to/index.txt', 'newname.txt'); 回答2: If you are trying to recursively

Central Directory corrupt error in ziparchive

霸气de小男生 提交于 2019-12-22 04:13:13
问题 In my c# code I am trying to create a zip folder for the user to download in the browser. So the idea here is that the user clicks on the download button and he gets a zip folder. For testing purpose I am using a single file and zipping it but when it works I will have multiple files. Here is my code var outPutDirectory = AppDomain.CurrentDomain.BaseDirectory; string logoimage = Path.Combine(outPutDirectory, "images\\error.png"); // I get the file to be zipped HttpContext.Current.Response

Enable ZipArchive on localhost [closed]

僤鯓⒐⒋嵵緔 提交于 2019-12-21 07:34:34
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I need to enable ZipArchive php class on my localhost , How can I enable it !? 回答1: add extension=zip.so to your php.ini if you already have it installed (not sure what OS you're on) Linux: pecl install zip Restart the web server once php.ini is edited. 来源: https://stackoverflow.com/questions/12477837/enable

PHP ZipArchive Corrupt in Windows

Deadly 提交于 2019-12-19 05:06:50
问题 I am using PHP's ZipArchive class to create a zip file containing photos and then serve it up to the browser for download. Here is my code: /** * Grabs the order, packages the files, and serves them up for download. * * @param string $intEntryID * @return void * @author Jesse Bunch */ public static function download_order_by_entry_id($intUniqueID) { $objCustomer = PhotoCustomer::get_customer_by_unique_id($intUniqueID); if ($objCustomer): if (!class_exists('ZipArchive')): trigger_error(