SharpZipLib compressed and transmitted to third-party platforms does not recognize the problem

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.