I use multiple file upload and I want to assign each file name with the global array called img using the foreach how can I do it in asp.net/c#?
string[] img={""};
foreach (string s in Request.Files) {
HttpPostedFile file = Request.Files[s];
int fileSizeInBytes = file.ContentLength;
string fileName = file.FileName;
string fileExtension = "";
if (!string.IsNullOrEmpty(fileName)) {
fileExtension = Path.GetExtension(fileName);
file.SaveAs(filename);
}
}