Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
krishna

Registered:
Posts: 139
Reply with quote  #1 
Hi

I tried dontnetzip for zipping and downloading files from server folder.

I copied ionic.zip.dll and ionix.zip.xml to bin folder.
Created a button in the buttons region.

It seemed a simple three line code but it is not working for me.
I am using ISD10.2.1 and .Net 4.0

I am uploading images to a server folder with sub directories.
I need to download the directory-subdir-files to the client side
from a button click.

Any help is appreciated.
thanks
Krishna


pinbot

Avatar / Picture

MVP Consultant
Registered:
Posts: 955
Reply with quote  #2 
Maybe same problem as this?  http://sjc.ironspeed.com/post/download-a-file-from-the-file-system-no-longer-working-8480570?pid=1295491764#gsc.tab=0


Turn off Smooth Panel Updates.



__________________
C. Bryan Patrick II
Iron Speed Designer MVP Consultant
Pseudo Consulting
krishna

Registered:
Posts: 139
Reply with quote  #3 
Hi 

Thanks. Turned off smooth panel update.
Now the button click is respoding.
But still nothing happens.
There is a flicker in the screen and nothing else.
I am using this code inside a button click.

Try



Using zip As New ZipFile()
zip.AlternateEncodingUsage = ZipOption.AsNecessary
'zip.AddDirectoryByName("DOCS")

zip.AddFile(SERVER.MAPPATH("../DOCS/A1.JPG"), "Files")
zip.AddFile(SERVER.MAPPATH("../DOCS/A2.JPG"), "Files")


Response.Clear()
Response.BufferOutput = False
Dim zipName As String = [String].Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"))
Response.ContentType = "application/zip"
Response.AddHeader("content-disposition", "attachment; filename=" + zipName)
zip.Save(Response.OutputStream)
Response.[End]()

Response.Close()
HttpContext.Current.ApplicationInstance.CompleteRequest()

End Using

Catch
..



End Try

All I wanted is to zip all the files from a server folder and save it as zip in the client 
machine.

Please advise.
thanks 
Krishna

miles

Avatar / Picture

MVP Consultant
Registered:
Posts: 1,659
Reply with quote  #4 
why do you have square brackets here?

Response.[End]()

I would load your project into VS and make sure it compiles correctly.

HTH,

__________________
Miles Gibson, MScIS
Iron Speed MVP
Senior Consultant, Principal
Milestone Software Inc.

http://www.ironspeedmvp.com\localizer 
Email: miles@milestone.ca
Milestone Localizer: Full Localization for your Iron Speed applications!
krishna

Registered:
Posts: 139
Reply with quote  #5 
Hi
I have modified the code; smooth panel update = false; button postback  true.

Public Overrides Sub Button_Click(ByVal sender As Object, ByVal args As EventArgs)
Dim fs As System.IO.FileStream
fs = New System.IO.FileStream(FullPathFile, _
System.IO.FileMode.Open, _
System.IO.FileAccess.Read, _
System.IO.FileShare.Read)

Try

'This method is initially empty to implement custom click handler.
Using zip As New ZipFile()
zip.AlternateEncodingUsage = ZipOption.AsNecessary
zip.AddFile(SERVER.MAPPATH("../DOCS/A1.JPG"), "Files")
zip.AddFile(SERVER.MAPPATH("../DOCS/A2.JPG"), "Files")

Dim bufSize As Integer = CType(fs.Length, Integer)
Dim buf(bufSize) As Byte
Dim bytesRead As Integer = fs.Read(buf, 0, bufSize)

Me.Page.Response.ClearContent()
Me.Page.Response.ClearHeaders()
Me.Page.Response.BufferOutput = False

Dim zipName As String = "zippedfile"
Me.Page.Response.ContentType = "application/octet-stream"
Me.Page.Response.AppendHeader("content-disposition", "attachment; filename=\" + zipName)

Me.Page.Response.OutputStream.Write(buf, 0, bytesRead)
Me.Page.Response.Flush()
Me.Page.Response.Close()

End Using
Catch ex As Exception

Me.Page.ErrorOnPage = True

' Report the error message to the end user
Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message)

Finally
fs.Close
End Try
End Sub

The themed button is set in a table row. When I click the button.. screen flickers..
waiting for localhost.. message appears. Then nothing.

I have added Imports Ionic.Zip
I have copied Ionic.Zip.Dll in the bin dir.

Please advise.
regards
Krishna


Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement