By pressing the "Show zipped files' details in RadGrid" button the data from the zip file will be read and the details will be shown in Telerik’s ASP.NET Grid control. If you select the “Keep the info about my uploaded items upon a next upload” checkbox, the data about your previously uploaded items will be preserved upon a consecutive upload.
The example demonstrates how to read all the data from a ZIP file simultaneously and display the information about the compressed files in Telerik’s ASP.NET Grid - name, original and compressed size. In order to load data from uploaded ZIP files, you can take advantage of the ZipArchive and ZipArchiveEntry classes and their methods. For example:
UploadedFile file = AsyncUpload1.UploadedFiles[0];
using (ZipArchive archive = new ZipArchive(file.InputStream))
{
List<ZipArchiveEntry> allEntries = archive.Entries.ToList();
foreach (ZipArchiveEntry entry in allEntries)
{
FileHelper fileHelper = new FileHelper();
fileHelper.CompressedSize = entry.CompressedLength;
fileHelper.UncompressedSize = entry.Length;
fileHelper.FileNameInZip = entry.Name;
...
byte[] data = new byte[entry.Length];
Stream entryStream = entry.Open();
BinaryReader reader = new BinaryReader(entryStream);
reader.Read(data, 0, data.Length);
fileHelper.Data = data;
Files.Add(fileHelper);
}
}