Posts Tagged ‘Upload Multiple files using fileupload control In asp.n’
Hello Friends
Here i write some thing for .net devlopers who need to upload multiple file with help of fileupload control in asp .net. nice thing about this code is you don`t have to create as much button as your fileupload control you add in your aspx page. this code gives you upload all files with single click it is same as yahoo mail attach file in mail.
Please see below code and follow that all.
Make One Upload.aspx page and paste this code in that page.
Add Five or six or as you want fileupload control and one button with id “btnUpload” and create one click event for that button. paste below code in that event.
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Try
Dim FC As HttpFileCollection = Request.Files
For i As Integer = 0 To FC.Count – 1
Dim Upload As HttpPostedFile = FC(i)
If Upload.ContentLength > 0 Then
Upload.SaveAs(Server.MapPath(“~/MemberSection/plans”) & “/” & System.IO.Path.GetFileName(Upload.FileName))
End If
Next i
Catch ex As Exception
Response.Write(“Error:
” & ex.Message)
End Try
End Sub
Enjoy Multiple file upload with single click.
Hello ! I am Arjun Jadeja a Software Engineer by Profession. You can contribute and I will distribute your ideas through this site. Thanks and Enjoy