public Boolean WriteBlobsToDB(byte[] buffer, int offset, int fileSize, string fileName, string fileType, string user, int count, int NChunks, string md5Src,int id) { bool ret = false; int l = buffer.Length; // The buffer length is almost 2 MB var allData = new byte[fileSize]; int offst = count * offset; // count is 0 the first timethen each time a new buffer comes, the value of count in count++ Buffer.BlockCopy(buffer, 0, allData, offst, fileSize); if (count == NChunks-1 ) // NChunks is the number of how many time the buffer would be passed here { // the meaning of this if is that, when all the buffer of a file is passed then move to the database and upload the table File_List wfl = new File_List(); fl.FileName = fileName; fl.Id = id; fl.FileType = fileType; fl.MD5 = md5Src; fl.Data = new Binary(allData); try { dc.SubmitChanges(); } catch (Exception e) { Console.WriteLine(e); } } return ret; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)