我壓縮上傳的.pdf
文件並將它們保存到服務器的文件系統。一切正常,但文件變大,從30kb到48kb。我可能做錯了什麼?下面的代碼部分,我壓縮上傳的文件:壓縮pdf文件使其更大
FileStream sourceFile = System.IO.File.OpenRead(filePath);
FileStream destFile = System.IO.File.Create(zipPath);
GZipStream compStream = new GZipStream(destFile, CompressionMode.Compress);
try
{
int theByte = sourceFile.ReadByte();
while (theByte != -1)
{
compStream.WriteByte((byte)theByte);
theByte = sourceFile.ReadByte();
}
}
如果我手動壓縮文件系統中的相同文件,它會變小。 – 2013-04-07 13:26:33