我想将文件转换为 byte[] 然后保存。但是在保存时说该文件正在使用中。将文件作为字节读取后,我应该如何关闭它?
void Function(string UploadPath, RadAsyncUpload RadAsyncUploadName)
{
foreach (UploadedFile file in RadAsyncUploadName.UploadedFiles)
{
FileStream tmpFile = (FileStream)file.InputStream;
byte[] data = File.ReadAllBytes(tmpFile.Name);
//close the file here
Function2(data);
file.SaveAs(Server.MapPath(UploadPath)+file.GetName());
}
}