Hi, i've notice that this was not asked before so i want to ask this question...
currently im writing an upload controller to upload some quite a large files. but i notice when it upload large file, the CPU and RAM go peak and this is really not what i want to (of course you too)
my controller is look like:
int Count = 0;
string _uploadsFolder = HostingEnvironment.MapPath("~/Upload/Files/Images/");
for (int i = 0; i < Request.Files.Count; i++)
{
HttpPostedFileBase _file = Request.Files[i];
// Validation ......
FileMIME mimetype = new FileMIME();
mimetype.AllowedMimeTypes.Add("image/png");
mimetype.AllowedMimeTypes.Add("image/jpeg");
mimetype.AllowedMimeTypes.Add("image/gif");
if ((_file.ContentLength > 0) && (_file.ContentLength < 4194304) && (mimetype.IsImage(_file)))
{
string guid = Guid.NewGuid().ToString();
string _fileLocation = Path.Combine(_uploadsFolder, Path.GetFileName(_file.FileName));
_file.SaveAs(_fileLocation);
Count++;
}
}
Is there anyway to make this buffer into HDD instead of ram?
thank you very much...