dotnetzip

Error when creating Zip file using DotNetZip: Unexpected end of archive

巧了我就是萌 提交于 2019-12-13 07:06:39
问题 I have a method that zips up one or more files using DotNetZip, and it has been working correctly. I received an error for the first time today and it appears to be related to the total size of the archive. Using the same 60mb .tiff image, I would add a few extra copies, test, repeat. It worked fine until about 10 images were added, then, when I opened the Zip file using WinRar, I would get the "Unexpected end of archive" error. Testing in this manner, I believe I've ruled out the problem

Sending gzipped data over a network from C# to Java

你。 提交于 2019-12-13 04:49:18
问题 I have an application that sends data gathered from a data source on my PC (say, Excel or Access) to a receiving app on an Android tablet. I am in the testing stage of compressing the data before it is sent and then decompressing it after it is received. I'm using GZIP for this, with DotNetZip on the C# side and the built-in GZIPInputStream class on the Java side. I'm having issues getting it to work properly. When I do a test just on one side (compressing and decompressing to see if the data

How to open up a zip file from MemoryStream

試著忘記壹切 提交于 2019-12-13 02:46:04
问题 I am using DotNetZip. What I need to do is to open up a zip files with files from the server. The user can then grab the files and store it locally on their machine. What I did before was the following: string path = "Q:\\ZipFiles\\zip" + npnum + ".zip"; zip.Save(path); Process.Start(path); Note that Q: is a drive on the server. With Process.Start, it simply open up the zip file so that the user can access all the files. I like to do the same but not store the file on disk but show it from

Corrupted Zip while returning from Web API?

无人久伴 提交于 2019-12-12 20:14:01
问题 On my MVC project I have an AJAX call to a Web API. I send an array of documents' routes, the API (should) zips them and returns the zip file . self.zipDocs = function (docs, callback) { $.ajax({ url: "../SharedAPI/documents/zip", type: "POST", data: docs, contentType: "application/json", success: function (data) { var zip = new JSZip(data); var content = zip.generate({ type: "blob" }); saveAs(content, "example.zip"); }, error: function (data) { callback(data); } }); } And my ZipDocs function

Add Files Into Existing Zip

放肆的年华 提交于 2019-12-12 12:12:18
问题 I can successfully extract files from a zip folder into a folder, but I am not quite sure how to take those files and add them into an existing zip file. I extract them into a directory onto the desktop called "mod", and then I need to add them to another zip file. Help? Here is my extraction code- ZipFile zip = ZipFile.Read(myZip); zip.ExtractAll(outputDirectory,ExtractExistingFileAction.OverwriteSilently); Help is appreciated, thank you. 回答1: Try giving this a try, once you extract the

DotNetZip: Convert ZipFile to byte[] array

余生长醉 提交于 2019-12-12 11:27:58
问题 I'm using DotNetZip to add a file to a zip archive, which I've read from the file system. I'd like to convert the resulting ZipFile to byte[] array. Any assistance will be highly appreciated. My code is shown below. public byte[] AddPrjFile(FileStream shapeFileZip, Uri prjLocation) { string prjFileAbsPath = prjLocation.AbsolutePath; using (ZipFile zip = ZipFile.Read(shapFileZip)) { ZipEntry e = zip.AddFile(prjFileAbsPath); e.FileName = zipFile.Name + ".prj"; } return byte_array; } 回答1: You

DotNetZip: How to extract files, but ignoring the path in the zipfile?

帅比萌擦擦* 提交于 2019-12-12 07:46:47
问题 Trying to extract files to a given folder ignoring the path in the zipfile but there doesn't seem to be a way. This seems a fairly basic requirement given all the other good stuff implemented in there. What am i missing ? code is - using (Ionic.Zip.ZipFile zf = Ionic.Zip.ZipFile.Read(zipPath)) { zf.ExtractAll(appPath); } 回答1: You'll need to remove the directory part of the filename just prior to unzipping... using (var zf = Ionic.Zip.ZipFile.Read(zipPath)) { zf.ToList().ForEach(entry => {

How to remove guid from file name when creating zip file?

只谈情不闲聊 提交于 2019-12-12 02:44:15
问题 When user uploads multiple documents I am storing their files in my project like this: Guid id; id = Guid.NewGuid(); string filePath = Path.Combine(HttpContext.Server.MapPath("../Uploads"), Path.GetFileName(id + item.FileName)); item.SaveAs(filePath); So files are saved like this in my project: 1250a2d5-cd40-4bcc-a979-9d6f2cd62b9fLog.txt bdb31966-e3c4-4344-b02c-305c0eb0fa0aLogging.txt Now when creating zip files I am getting same name of this files when extracting zip files but I don't want

Zip file from URL not valid

倖福魔咒の 提交于 2019-12-12 01:39:08
问题 I followed another post to be able to zip the content of an URL.. When I click my button Download, I "zip" the content of the URL and I save it in the default download folder... So far this is my code: WebClient wc = new WebClient(); ZipFile zipFile = new ZipFile(); string filename = "myfile.zip"; zipFile.Password = item.Password; Stream s = wc.OpenRead(myUrl); zipFile.AddeEntry(filename, s); return File(s, "application/zip", filename); it´s similar to this one (which zips the content of a

Auto Extract a zip file

。_饼干妹妹 提交于 2019-12-11 18:49:24
问题 I'm trying make a program that extracts a specific zip file everytime the program launches. this is my code to create the zip file: //creating the file ZipFile File = new ZipFile(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ABCD.zip"); //Adding files File.AddFile(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\ab.dat", ""); File.AddFile(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\cd.dat", ""); //Save