| Dart Home | PowerTCP Zip Compression for .NET | Custom Development | Reply | PowerTCP Zip Compression for .NET Topics | Forums |
| Author | Forum: PowerTCP Zip Compression for .NET Topic: Error: Temporary file creation failed |
| prashU From: Anaheim, CA USA Posts: 4 Member Since: 03/18/04 |
posted March 18, 2004 1:12 PM Hi, I am evaluating this control for our Intranet application and i keep getting an error "Operations on the temp file failed. Either the temp file has been destroyed or moved. " OR "The temporary file creation failed" Can someone please |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted March 18, 2004 1:23 PM What do you have Archive.TempFileDirectory to? Have you tried changing it? |
| prashU From: Anaheim, CA USA Posts: 4 Member Since: 03/18/04 |
posted March 18, 2004 1:40 PM Thanks Tony, I had not changed the default temp directory. Changing it to a folder where ASP net account had write permission solved it. I have another question. In my ASP.Net application, i am creating a zip file once user creates selects some files and opts to get a zip file. I am using the archive1.Add(<folder name>) to create a zip file but can u suggest the best way to deliver this file to the user? I was trying to use the Response object to write it to the user's browser using Response.WriteFile but did not succeed. |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted March 18, 2004 1:44 PM Have you seen the WebArchive sample? It does pretty much what you are asking. |
| prashU From: Anaheim, CA USA Posts: 4 Member Since: 03/18/04 |
posted March 18, 2004 1:57 PM i checked that, but i was trying to use the addfolder property and create a file on web server and then write it to browser through Response object. The example uses compressed memorystream to send through response object with Response.ContentType = "application/octet-stream". If I want to avoid using the MemoryStream and flush the actual zip file through response object, how to do it?. I can always just point to the actual file through a mapped path from webserver like Response.Redirect (<mapped-path-to-file's-folder>/<file-name>) but is there any better way? |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted March 18, 2004 2:44 PM Can you use an IO.FileStream? Just save the zip file to some temporary name, then where we have compressedData.Read you could use FileStream.Read |
Tony Priest![]() From: Utica, NY USA Posts: 8466 Member Since: 04/11/00 |
posted March 18, 2004 2:55 PM Here's the code that would be changed in the sample. First change the code where the zip file is created to store to a directory that has write permission for the ASPNET user: Dim filename As String = "c:\ASP.NETAllowedDirectory\" + Page.Session.SessionID.ToString Archive1.Zip(filename) Session.Add("archive", filename) Then change the SendArchivedFile sub like so: Private Sub SendArchivedFile() If Not Page.Session("archive") Is Nothing Then Dim Filename As String = Page.Session("archive") Dim ZipFile As FileStream = New FileStream(Filename, FileMode.Open) Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader("Content-Disposition", "attachment; filename=" + Chr(34) + "WebArchive.zip" + Chr(34)) Dim data(1023) As Byte Dim bytes As Integer = -1 Do bytes = ZipFile.Read(data, 0, data.Length) Dim buffer(bytes - 1) As Byte System.Array.Copy(data, buffer, buffer.Length) Response.BinaryWrite(buffer) Loop While (bytes > 0) End If Response.End() End Sub |
| hingen hnguyen@chickering.com From: Cambridge, MA USA Posts: 3 Member Since: 08/21/07 |
posted August 21, 2007 10:17 AM Hi Tony, I did not set the TempFileDirectory for the archive (I will try it now) but it sometimes works for me and sometimes doesn't (it gives the error message "Operations on .. destroyed or moved") Do you know why it behave that way? if I don't specify the TempFileDirectory then how does the software determine what directory to store the temp file? Thanks |
| Raj From: Rome, NY, USA Posts: 389 Member Since: 02/01/06 |
posted August 21, 2007 1:53 PM I am not sure why you are getting that error. do you see a similar behavior when you use one of the samples? If you do not specify anything for Archive.TempFileDirectory Property, it takes the default as system default directory. As per the help file: "Archive.TempFileDirectory Property Value: A string representing the directory to store temporary files. The default is the system default directory." -Raj |
| hingen hnguyen@chickering.com From: Cambridge, MA USA Posts: 3 Member Since: 08/21/07 |
posted August 21, 2007 2:08 PM Hi Raj, Thanks for reply, It seems that I don't have problem when the archive read and write to my local machine directory. However, when using read read or write to network, it start givimg me these two errors: 1. Operations on the temp file failed. Either the temp file has been destroyed or moved. (sometimes gives this error) 2. The central directory end record cannot be found. Either it is not a standard zip format, or if you are trying to open a spanned zip archive on removable media. Please insert the last volume. (I see this error manytimes) Once I see the second error, the archive file seems to be corrupted, I can not open the file (double click) archive file. The error is gone when I comment this code out: 'Archive1.CompressionLevel = CompressionLevel.High Do you have any idea if that code is really cause the problem? Thanks Hai |
| Jamie Powell (Admin) From: Rome, NY USA Posts: 448 Member Since: 03/13/07 Extra Support Options Custom Application Development |
posted August 21, 2007 3:29 PM Hello, this request needs to be handled through our administrative procedures prior to response. Please contact sales@dart.com directly about this issue. Thank you. |
| Reply | PowerTCP Zip Compression for .NET Topics | Forums |
This site is powered by
PowerTCP WebServer for ActiveX
|