Downloading 4GB file from .net application
<p>My requirement is to upload 4GB file from .net application and Download the same file from .net application.we were able to upload and download 4GB file using .net application.</p>

<p>So to upload 4GB file we had splitted the 4GB file and  while downloading we merged the file using FileStream objects in C#.</p>

<p>Now I am able to save the file in client machine when I click the Download button from my .net application.But while saving the file stream objects writes  byte byte and saves the file to user's machine.It is taking more time to save file to the client machine.Even for 100MB file its takes to save approximately 2 hrs.So If I save 4GB it will take long time.</p>

<p>What is  the best way to improve the speed.?
Is there any Filestream objects available?
please help me to download the 4GB file from Networkshare using .net application.
if you find any other solution also to uplaod and download 4gb file in .net it would be good.</p>

<p>I am unable  to use asp .net download code to download 4GB file.So We followed the splitting approach.
Please help me to improve the speed of the below code.I am using Asp .net 3.5 application.</p>

<p>my code while Uploading:</p>

<pre><code>                    FileStream foption = new FileStream(strFileName, FileMode.Open);
                    len = foption.Length;
                    eachSize = (int)Math.Ceiling((double)len / x);
                    foption.Close();
                    FileStream inFile = new FileStream(strFileName, FileMode.OpenOrCreate, FileAccess.Read);
                    for (int i = 0; i &lt; x; i++)
                    {
                        FileStream outFile = new FileStream(strDir + "\\" + i + ".zip", FileMode.OpenOrCreate, FileAccess.Write);
                        int data = 0;
                        byte[] buffer = new byte[eachSize];
                        if ((data = inFile.Read(buffer, 0, eachSize)) &gt; 0)
                        {
                            outFile.Write(buffer, 0, data);
                        }
                        outFile.Close();
                    }
</code></pre>

<p>my code while downloading</p>

<pre><code>FileStream outFile = new FileStream("\\\\" + clientIPAddress + "\\upload\\output.zip", FileMode.OpenOrCreate, FileAccess.Write);
            for (int i = 0; i &lt; 10; i++)
            {
                int data = 0;
                byte[] buffer = new byte[4096];
                FileStream inFile = new FileStream(strMediaPath + "\\" + i + ".zip", FileMode.OpenOrCreate, FileAccess.Read);
                while ((data = inFile.Read(buffer, 0, 4096)) &gt; 0)
                {
                    outFile.Write(buffer, 0, data);
                }
                inFile.Close();
            }
            outFile.Close();
</code></pre>

<p>Thanks
Edwin</p>
