Thanks wes and sebastian for your reply
this is the req to store the file into the database in binary formate
i have wrote the code for uploading and dowloading also but this works for the small size of file not for bigger one
see code below
DataTable dtfile = new DataTable();
ViewState["DocType"] = e.File.GetExtension();
using (Stream f = new FileStream("C:/Documents and Settings/" + e.File.FileName.ToString(), FileMode.Open))
{
int offset = 0;
long len = f.Length;
byte[] buffer = new byte[len]; // here i got error while upload bigger file out of memory exp
int readLen = 100; // using chunks of 100 for default
while (offset != len)
{
if (offset + readLen > len)
{
readLen = (int)len - offset;
}
offset += f.Read(buffer, offset, readLen);
}
WriteToDB(e.File.FileName, e.File.ContentType, ref buffer);
}
}
while using above code the file is uploading into the db but i got exeption when byte[] buffer = new byte[len];
when upload the larger file the byte array goes out or memory exption
please let me know what can i use in place of byte array or any other solution please provide code if poosible wating for you reply