Here i will show how to upload multiple file using File upload control in asp.net.For this i have taken one HttpFileCollection to upload the multiple files.
CodeBehind:
CodeBehind:
protected void btnUpload_Click(object sender, EventArgs e) { if (FileUpload.HasFile) { // Get the HttpFileCollection HttpFileCollection uploadeFiles = Request.Files; for (int i = 0; i < uploaded.Count; i++) { HttpPostedFile Hpostfiles = uploadedFiles[i]; if (Hpostfiles.ContentLength > 0) { Hpostfiles.SaveAs(Server.MapPath("~/Upload/Test/") + Path.GetFileName(Hpostfiles.FileName)); } } } }
No comments:
Post a Comment