Problem Description: In the project need to compress the file and then transfer to the three-party MMS sent, using SharpZipLib compression, originally using J # for compression, but after the SharpZipLib compressed zip file transfer In the past, the general report sent failed. Finally join s.usezip64 = Usezip64.off; After this sentence, solve the problem. Hereby record.
using (zipoutputstream s = new Zipoutputstream (File.create (Argzippath))) {S.usezip64 = Usezip64.off; S.setlevel (9); 0-store 9-means best compression byte[] buffer = new byte[4096]; foreach (string file in Argfiles) {//Using GetFileName makes the result compat Ible with XP//As the resulting path was not absolute. ZipEntry entry = new ZipEntry (path.getfilename (file)); Setup the entry data as required. CRC and size is handled by the library for seakable streams//So no need to do them here. Could also use the last write time or similar for the file. Entry. DateTime = DateTime.Now; S.putnextentry (entry); using (FileStream fs = FIle. OpenRead (file)) {int sourcebytes; do {sourcebytes = fs. Read (buffer, 0, buffer. Length); S.write (buffer, 0, sourcebytes); } while (Sourcebytes > 0); }} s.finish (); S.close (); }
SharpZipLib compressed and transmitted to third-party platforms does not recognize the problem