upload file only to unzip it without writing file on server - c#

In my asp.net aplication I would like to give the oportunity to the user to check on its local machine zip file. Then I would like to get this file on server(without saving it on the server) unzip it proceed and save proceeded data to database.
What should I do to accomplish this task? Thank You for any hints

I would use a zip library to read in the zip file stream and process the files contained inside. I have previously used SharpZipLib for this purpose before. See SharpZipLib Examples for more information.

Related

SSIS - Move and open zip file / load xml file to the BD

first of all you're amazing.
About my problem, what i have to do, is:
I have a folder in the sftp with multiple files (zip).
What i need do do is, load those files from the sftp, one by one to a stagging folder, open them, inside they are 3 files, 2 pdf and one xml.
I need to upload the xml to the bd.
After that, based in one field of the xml (ExternalID) i need to move the file in some folder, that depends of the ExternalID, before i move the files, i need to zip all 3 files and name the zip with the ExternalID.
Anyone did something similar? Or some advises to do this?
Any help will be appreciated.
Regards.
SSIS doesn't support SFTP natively.
WinSCP (free of charge) could be handy.
Here is its link: SFTP Task for SSIS/SSDT

C#, Compress directory with files opened for other applications

I'm working in a very basic C# application, I want to compress a directory that has some files (specifically a dbf database) that are already opened or in use for other software.
I use the class "ZipFile" in this way:
ZipFile.CreateFromDirectory(source, path);
And I get an exception that says that It could not access to the file because it was already in use for other application.
Is there another way to do this?
Thanks!

See when the zip file has been zipped?

I have googled without any luck.
My question is if there is a way to see when the file has been zipped? I am not asking for when the file has been created or modified rather to see when it has been zipped.
Is there a byte I can read from the zipped file somehow to find out this in code (C#)?
Best regards
As far as I can tell,that information is not stored in the zip file. The only info you can get is the last time that file inside the zip was modified. That datetime could or could not be the first time that file was included in the zip file.
If you want to get the last time the entry in the zip archive was changed, you can use the ZipArchiveEntry.LastWriteTime in the System.IO.Compression Namespace.
If you have any doubt of what info is availble in a zip file, you can check this wikipedia article : Zip File Format

C# Read Data from an URL which downloads a zip file with an CSV file in

I would like to know if there is anyway to use Httprequest or Webclient to read data from an URL (The link is not valid because i changed a little bit because there are private data there).
Like:
https://download.somewhere.com/ReportDownload
The link above is pretty much the format, from the link, you can download a zip file with a CSV file in it. I am wondering if there is a way to use C# to parse out the data instead of downloading it, unzip it and read data from the csv. I would like to get the data and pass that to a variable without any physical download.
If the file provider/site is yours, then yes. You can write a webservice method for that or something like that.
If not, that's not possible. But you can download it to a temporary folder, read it, parse it and delete it aftwerwards.
Hope it helps.

Zip files which are located in IsolatedStorage

My application need to download multiple files in Silverlight, and because I don't want to ask user multiple times for permission to save the files, I save the files in IsolatedStorage first and then I want to zip them all to a file and ask once for saving permission.
therefore I used SharpZipLib to zip multiple files which are located in IsolatedStorage, the problem is that SharpZipLib just accept file address as ZipEntery:
ZipEntry z= new ZipEntry(name);
and as you know cause the files are located in IsolatedStorage I don't have the address of them.
I saw sample on Create a Zip from/to a memory stream or byte array but I cant use it for multiple files.
Please help me to find a way to use SharpZipLib or introduce me another way to downloading multiple files without asking multiple times for permission.
The name in ZipEntry z= new ZipEntry(name); is a logical/relative name inside your zip, you can establish it any way you want.
So as long as you can re-open you IsoStorage files as a Stream, you should be able to use SharpZip.

Categories

Resources