Rename file name as user friendly when zip files

Dec 4, 2009 at 5:28 PM

I have a requirement to download multiple files from UI in vb.net 2.0 I have gridview with selection of files as check box that loads from database.When i load the grid  i have file name as nice name but when

when i read the files from physical folder it has different name like e.g when file was upload it upload as img1.jpeg and behind the seen i rename it as 100023-HM-jpeg so for download  in grid i show user as nice name(100023-HM-jpeg)

and when i zip files i read file from physical folder as img1.jpeg but when user save zip file i want to save file as nice name 100023-HM-jpeg.I try all possible values but no luck hope understand my issue.Can any one help me.

thanks

 i am using following code.

 

 

<font size="2" color="#0000ff"><font size="2" color="#0000ff">

Dim

</font></font><font size="2" color="#0000ff">

 

</font>

filesToInclude As New System.Collections.Generic.List(Of String)()

 

 filePath = Path.Combine("C:\Upload")  'where real images are uploads like with file name as (img1.jpeg)

<font size="2">

 

</font>

For Each item As AjaxFileInfo In Session("Checked")

 

 

Dim filerow As DataRow = SampleDB.ExecuteDataRow("select * FROM dbo.TSK_TASK_UPLOAD_IMAGES WHERE Row_key={0}", item.Rowkey)"\" & DirectCast(filerow("IMAGE_FILENAME_ORG"), String))

 

filesToInclude.Add(filePath)

'item.name is my real name i want to add when zip file is save

Next

 

 Dim enc As Ionic.Zip.EncryptionAlgorithm = Ionic.Zip.EncryptionAlgorithm.None

enc = Ionic.Zip.EncryptionAlgorithm.WinZipAes256

<font size="2">

 D

</font>

im c As System.Web.HttpContext = System.Web.HttpContext.Current <font size="2">

 

</font>

 

Dim archiveName As String = String.Format("archive-{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss")) <font size="2">

Response.ContentType =

</font>

"application/zip"

Response.AddHeader("content-disposition", "filename=" + archiveName)<font size="2">

 

</font>

 

Using zip As New Ionic.Zip.ZipFile()

zip.Encryption = enc

<font size="2">

zip.AddFiles(filesToInclude,

</font>

"files")

zip.Save(Response.OutputStream)

<font size="2">

 

</font>

 

End

Using

<font size="2">

 

</font>

 

 

Response.Close()

 

 

 

 

 

 

<font size="2">

 

</font>

 

 

 

 

Coordinator
Dec 5, 2009 at 12:58 PM

I can't understand what you're asking.

Also, I'm not a good source for help on gridviews, checkboxes, uploads, and downloads.

I can help you with only specific questions or problems relating to DotNetZip.

If you ask a specific question about DotNetZip, I may be able to help.