if (flpProspectus.HasFile || flpOrientation.HasFile)
{
string fileExtension = string.Empty;
int fileSize = 0;
HttpFileCollection hfc = Request.Files;
string[] arr = new string[10];
string path1, path2, path3, path4, path5 ,path6,path7, path8,path9,path10 =string.Empty;
string filePath = string.Empty;
for (int i = 0; i < hfc.Count; i++)
{
if (hfc.GetKey(i) == "flpOrientation")
{
filePath = "college/fileupload3";
}
if (hfc.GetKey(i) == "flpProspectus")
{
filePath = "college/fileupload4";
}
fileExtension = System.IO.Path.GetExtension(hfc[i].FileName);
fileSize = hfc[i].ContentLength;
if (hfc[i].ContentLength > 0)
{
hfc[i].SaveAs(Server.MapPath(string.Format("~/{0}/", filePath)) + System.IO.Path.GetFileName(hfc[i].FileName));
string filepath = Server.MapPath(string.Format("~/{0}/", filePath));
string path = string.Format("{0}/", filePath) + hfc[i].FileName;
if (i < 5)
{
arr[i] = path;
path1 = arr[0]; path2 = arr[1]; path3 = arr[2]; path4 = arr[3]; path5 = arr[4]; path6 = arr[5]; path7 = arr[6];path8 =arr[7]; path9 =arr[8]; path10= arr[9]
}
}
}
}
sir above is my code working fine but i getting path problem means i mention on 1 file upload control user can choose only 5 file and 2 nd file upload control same 5 file so suppose user use in 1 file upload control only 2 file
so i want to store file path only in path1 and path2 and path3 path4 ,path 5 should null value and user choose on second file upload control 3 file then file should be strored in file path6 ,path7 and path8 like that
so please help me