How to upload/download the folder and its contents from web server to local machine and local machine to web server

Hi,
    i am using asp.net with c# and creating the web project In my project Now I am  using the Button and listbox and on button click event I am using the code 
protected void AddFolder_Click(object sender, EventArgs e)
    {
        string strPath = "";
        string strCaption = "Browse a directory for uploading Album.";
        //DialogResult dlgResult;
        string dlgResult = "";
        Shell32.ShellClass shl = new Shell32.ShellClass();
        Shell32.Folder2 fld = (Shell32.Folder2)shl.BrowseForFolder(0, strCaption, 0, System.Reflection.Missing.Value);
        if (fld == null)
        {
            dlgResult = "Cancel";//DialogResult.Cancel;
        }
        else
        {
            strPath = fld.Self.Path;
            lstboxFile.Items.Add(strPath);
            BaydonConstants.hif1.Add(strPath);
            dlgResult = "Ok";//DialogResult.OK;
        }
    }

So In this case I have to select the path for a folder and Zip this folder and upload the zip file on the web server and also reverse this process (server to local machine).please help any related site and code which can help me ......waiting to hopefully response.....

Thanks and regards
      Amit
Regards
Amit Saxena
Sr. Software Developer
0
amitsec
12/11/2007 7:33:48 AM
📁 asp.net.getting-started
📃 91979 articles.
⭐ 3 followers.

💬 4 Replies
👁️‍🗨️ 1081 Views

Hi,

Can you please reorganise your code because it is really hard to read. So your question is how you can upload a whole folder without zipping it, is it?

Thanks


Don't forget to click (Mark as Answer) on the post that helped to solve your problem.
0
mr
12/11/2007 11:14:00 AM

Hi,

       No, I have to upload the folder with Zipping.....so the problem is that first i have to zip the folder and after zipping it should be upload ....please provide me any code and any idea which can help me to solve this problem....waiting ur response....

 

Thanks and Regards

           Amit


Regards
Amit Saxena
Sr. Software Developer
0
amitsec
12/12/2007 4:44:33 AM

Files can be uploded from a local machine to the server using the ASP.NET inbuilt server control, FileUpload

an article which explains uploading a file from local machine to web server can be found at:

http://aspalliance.com/150_How_to_Upload_files_in_ASP_NET

I am not sure whether we have an easy way to download the entire folder content. You might have to download the folder contents one by one.


Das (http://aspalliance.com/author.aspx?uId=697)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dont forget to click "Mark as Answer" on the post that helped you. This marks your thread as Resolved so we will all know you have been helped.
0
datagrid
12/12/2007 4:54:01 AM

Hi,

I don't think you can upload a folder to the server then ZIP it there. What you can do is the following

- Upload a ZIP folder and extract on the server.

- ZIP a folder which resides on the server local directory

There is a free open source library called csharpziplib. It has all the functionalities that you need to work with ZIP files (extract, zip...etc).

Regards


Don't forget to click (Mark as Answer) on the post that helped to solve your problem.
0
mr
12/12/2007 10:11:21 AM
Reply: