User (Old forums)MemberApril 24, 2008 at 12:07 pmPost count: 23064
I have a problem with the ZipWriter on and FTP Stream. If I run the code below on an empty Zip File it works fine. But when i try and append to the file I get a central header error. If i try to view the archive using the stream it also stops at the original entry. If i run similar code using a local FileStream and append to it, it works fine.
any help would be greatly appreciated.
(FtpConnection connection = new FtpConnection(hostname, port, user, pass))
AbstractFile ftpZipFile = new FtpFile(connection, “test.zip”);
using (Stream uploadStream = ftpZipFile.OpenWrite(false))
using (ZipWriter writer = new ZipWriter(uploadStream))
DirectoryInfo di = new DirectoryInfo(@”C:\testdir”);
FileInfo files = di.GetFiles(“*.*”, SearchOption.AllDirectories);
foreach (FileInfo file in files)
ZipItemLocalHeader itemHeader = new ZipItemLocalHeader(@”\” + file.FullName,
using (FileStream stream = file.OpenRead())
byte buffer = new byte;
int bytesRead = 0;
while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)
writer.WriteItemData(buffer, 0, bytesRead);
I belive the issue is the writer is appending the new data as it would a log file which is cuasing the problem. Is there another way to keep adding files using the Real-Time component and FTP?
Imported from legacy forums. Posted by sniper (had 1030 views)Xceed SupportMemberApril 25, 2008 at 7:20 amPost count: 5658
Real-Time Zip does not support addind files to an already existing zip file by now. To do it, you must use ZipArchive class.
Imported from legacy forums. Posted by Chris [Xceed] (had 337 views)User (Old forums)MemberApril 25, 2008 at 11:16 amPost count: 23064
Thanks for the reply. Thats to bad though the real-time zip works great. will this be a consideration for future releases or is it just not possible given the way it streams it?
Imported from legacy forums. Posted by sniper (had 330 views)Xceed SupportMemberApril 25, 2008 at 11:27 amPost count: 5658
By now, the reason why it is not implemented is the fact that we would have to read almost the whole zip file to find the zip central directory (containing informations on all compressed files in the zip) to be able to know what is already in the zip and then, append the new files.
It is in the pipeline, but we don’t have a time frame for it. If you really need this feature, it could be done in custom development. Just contact email@example.com by mail or by phone for more informations.
Imported from legacy forums. Posted by Chris [Xceed] (had 1623 views)
- You must be logged in to reply to this topic.