Is there any way to implement a .net Web api to receive a lrage file(>2gb) using bufferlessinput stream without multipart/form-data mime type?
I am trying to do it with below code, but its not reading the stream completely. I am trying to upload 100 MB file, but it writes only 10MB to "c:\sampl.zip" and comes out. what went wrong in below code?
public async Task<HttpResponseMessage> FileReceive1r(string id)
{
var content = new StreamContent(HttpContext.Current.Request.GetBufferlessInputStream(true));
Stream stream = HttpContext.Current.Request.GetBufferlessInputStream(true);
StreamReader rdr = new StreamReader(stream);
while(!rdr.EndOfStream)
{
//FileStream fs = new FileStream(@"c:\sampl.zip", FileMode.OpenOrCreate);
StreamWriter wrtr = new StreamWriter(new FileStream(@"c:\sampl.zip", FileMode.OpenOrCreate));
wrtr.Write(rdr.ReadToEnd());
wrtr.Close();
}
rdr.Close();
return await Task.FromResult(new HttpResponseMessage(HttpStatusCode.Created));
}