| Dart Home | PowerTCP Zip Compression for Active | Custom Development | Reply | PowerTCP Zip Compression for ActiveX Topics | Forums |
| Author | Forum: PowerTCP Zip Compression for ActiveX Topic: Zip into stream in ASP does not work with larger files |
| voshkin From: samara, Russia Posts: 3 Member Since: 06/23/06 |
posted June 26, 2006 10:30 AM I am testing an application for a client to zip files & directories "on the fly" without creating temp zip files on the server. Your control has proved invaluable, and so far, it works as indented - it compresses single files or entire directories, however, when the size of the file exceeds couple of megabyte, the operation fails. At first I thought that the problem lies with the script timeouts, but that does not appear to be the case. Please point out the silly mistake which I made ;-) <% ' on the fly zipper Server.ScriptTimeout = 2000 DIM filename, path filename = Request.QueryString("filename") path = Request.QueryString("path") IF inStr(filename, "\") = TRUE OR inStr(filename, "/") = TRUE THEN ' Raise Security error Err.Raise 599, "SECURITY", "Security Violation, hacking atempt" END IF IF Ucase(Left(path, 1)) <> "E" THEN ' Raise Security error Err.Raise 599, "SECURITY", "Security Violation, hacking atempt" END IF ' Declarations Dim Zip1 Set Zip1 = Server.CreateObject("Dart.Zip.1") Dim span Set span = CreateObject("Dart.SpanSettings.1") Dim stream ' A DartStream, where the resulting zipped file will be placed. set stream = Server.CreateObject("Dart.DartStream.1") Zip1.BackgroundOperation = zipAboveNormal ' For use in IIS, be sure DoEvents is false Zip1.DoEvents = False Zip1.FileStore.Clear Stream.Clear ' IF THERE ARE NO SECURITY THREATS, ZIP ' Check the type of the operation IF Request.QueryString("type") = "file" THEN ' We are compressing a single file Zip1.FileStore.Add path Zip1.FileStore.Zip stream, span IF ERR <> 0 THEN CALL errhandle() IF Request.QueryString("type") = "folder" THEN ' We are zipping a whole folder Zip1.FileStore.Add path & "\*.*", TRUE Zip1.FileStore.Zip stream, span IF ERR <> 0 THEN CALL errhandle() END IF END IF IF stream.size = 0 THEN err.raise 404 err.description = "archive is 0 length<br>" & path IF ERR <> 0 THEN CALL errhandle() END IF ' Output the zip Response.Clear() Response.Buffer = true Response.ContentType = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment;filename=" & Chr(34) & filename & Chr(34) stream.Position = 0 Response.BinaryWrite stream.Readbytes() Stream.DeleteOnDestroy = True Set Stream = Nothing Response.End() END IF %> What is strange, is that this script works fine, for small files (2mb works, but not 50) and directories with small files – but not for anything larger… |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted June 27, 2006 3:28 PM What is the highest value you tried for ScriptTimeout? 2 seconds seems pretty low for a 50 meg file. |
| voshkin From: samara, Russia Posts: 3 Member Since: 06/23/06 |
posted June 27, 2006 4:34 PM it is my understanding that Server.ScriptTimeout = 2000 means 2,000 seconds, but this does not appear to be the cause of the problem as the broken zip arives after about half a second, just as a working zip. Is there a timeout in the control itself? P.S. further tests reveal that files or folders with multiple files of about <5 MB zip fine, anything above, returns a broken zip |
| voshkin From: samara, Russia Posts: 3 Member Since: 06/23/06 |
posted June 27, 2006 6:25 PM Whey! Now it is my turn to help! - The problem lies within the buffer size in IIS. By changing the AspBufferingLimit in the metabase.xml file to more then the default 4MB I have solved the problem ;-) |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted June 27, 2006 6:59 PM Thanks for the helpful follow-up! |
| Reply | PowerTCP Zip Compression for ActiveX Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|