vikasmathodu a

vikasmathodu a

  • NA
  • 3
  • 7.7k

Streaming the files from UI to database

Sep 4 2012 11:40 AM
I am uploading files to SQL Server
1.I am streaming the files from UI layer.
2.When it comes to Business layer here is the implementation.

HttpWebRequest request = WebRequest.Create(postUrl) as HttpWebRequest;

Stream requestStream = request.GetRequestStream();

byte[] buffer = new byte[8 * 1024];

int len;
while ((len = fileToUpload.File.Read(buffer, 0, buffer.Length)) >0)
{
requestStream.Write(buffer, 0, len);
requestStream.Flush();
}
return request.GetResponse() as HttpWebResponse;

I am chunking the inputstream in 8KB and sending it to the response stream.

My question is  ,if  the length of fileToUpload.File in the business layer is 1 GB ,so will it stored physically in the memory and affect the performance?