Login  
Search All Forums
Dart Home | PowerTCP Zip Compression for .NET | Custom Development Reply | PowerTCP Zip Compression for .NET Topics | Forums   
AuthorForum: PowerTCP Zip Compression for .NET
Topic: Zipping files from database blobbed records
peter.rogers

From: Ipswich, United Kingdom
Posts: 3
Member Since: 07/23/08
posted July 23, 2008 6:38 AM

Zip file is created and I can see the files in the zip, but when I extract them they are all 0 size.

Code snipet below, oFiles contains the blobbed records.

oFiles.Load(iFileId);
byte[] doc = (byte[])oFiles.dbFileData;
MemoryStream fileContent = new MemoryStream();
fileContent.Write(doc, 0, doc.Length);
archive1[i].Name = oFiles.dbFileName;
archive1[i].Size = oFiles.dbFileSize;
archive1.Add(fileContent);

thanks

Pete
Jason Farrar (Admin)

From: Oneida, NY USA
Posts: 223
Member Since: 07/24/07

Extra Support Options
Custom Application Development

posted July 23, 2008 12:33 PM

You need to set your input stream's position to 0 after writing to it and before adding it to the archive.

oFiles.Load(iFileId);
byte[] doc = (byte[])oFiles.dbFileData;
MemoryStream fileContent = new MemoryStream();
fileContent.Write(doc, 0, doc.Length);
fileContent.Position = 0; //Add this line.
archive1[i].Name = oFiles.dbFileName;
archive1[i].Size = oFiles.dbFileSize;
archive1.Add(fileContent);

------
-Non-current subscribers must contact sales@dart.com to update subscription and receive continued support as needed.
------

peter.rogers

From: Ipswich, United Kingdom
Posts: 3
Member Since: 07/23/08
posted July 24, 2008 3:40 AM

Thank you, that worked a treat!!
Reply | PowerTCP Zip Compression for .NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX