Download multiple files from server to client through .Net/C# code

We have an application developed in .Net 1.1 C# in which we are storing employee information in an Oracle 9i database and also storing jpg images of the employees in a specific folder on the application server.  The URL / location of these jpg images are stored against the employee record in the database.

The requirement right now is that the application displays the list of employees with checkboxes next to each, and the user will select some of the employees by checking the relevant checkboxes.  The user will then click on a "Download" button.  The application then needs to pick up the relevant data of all the selected employees and save it to the user's client PC in a single Excel file.  Next, the application also needs to save the jpg image file (photo) of the relevant employees into the same folder on the client PC.  In other words, if 5 employees are selected, then on clicking Download, we expect to generate 1 Excel file with relevant details of all 5 employees, and also 5 jpg files each being the photograph one of the employees selected.

We are successfully able to generate the Excel file and throw a Save dialog box to the user for saving the same on his PC.  We are unable to code for saving the jpg files on his PC.  We require a solution for this problem.
LVL 9
felixdsouzaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ColemssCommented:
This displays the data in a picturebox. use the bitmap to save it where you want.

String key = textBox1.Text;
            //
            // Create select command to get thumnail image using the ID
            //
            OracleCommand cmd = new OracleCommand
                ( "Select t.image.getContent(), t.thumb.getMimetype() from Photos t " +
                "where t.id= :v1", dbConn);
            OracleParameter paramID = new OracleParameter("id", OracleDbType.Int32,
                System.Convert.ToUInt32(key),
                ParameterDirection.Input);
            cmd.Parameters.Add(paramID);
 
            //
            // Execute the command as a reader commmand
            //
            OracleDataReader reader = cmd.ExecuteReader();
            if (!reader.Read())
            {
                textBox2.Text = "No data found for " + cmd.CommandText;
                return;
            }
 
            //
            // Obtain the binary data and mimetype from the SELECT
            //
            OracleBlob blob = reader.GetOracleBlob(0);
 
            Bitmap image = new Bitmap(blob);
            pictureBox1.Image=image;
0
felixdsouzaAuthor Commented:
Hi,

Thanks for the effort, but my application is a Web Application and not a Windows Application.  I need some code that will work for a Web application.
0
felixdsouzaAuthor Commented:
We have solved this problem by creating a zip file on the webserver and downloading the zip to the client's PC.  Hence closing this question.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.