I compress the uploaded .pdf
files and save them to server's file system. Everything works well, but the file gets bigger, from 30kb to 48kb. What could I be doing wrong? Here's the code part I compress the uploaded file:
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();
}
}