prob. related to image upload
hi every one
i am using this code to upload two images or you can upload no of images from this code .
string filepath = "C:\\Uploads";
HttpFileCollection uploadedFiles = Request.Files;
for (int i = 0; i < uploadedFiles.Count; i++)
{
HttpPostedFile userPostedFile = uploadedFiles[i];
userPostedFile.SaveAs(filepath + "\\" +
System.IO.Path.GetFileName(userPostedFile.FileName ));
} but whan i want to load only one image then it shows error:
Could not find a part of the path 'C:\Uploads\'.when i try to search that what is going on.then i came to know that if i select 1 image only then the value of uploadedFiles 2 that why loop run two times and show error .
my prob is why it takes 2 when i select 1 image only.
plz let me know.
thanks ...gaurav
|