Web Form

Rabbit W
Rabbit W used Ask the Experts™
on
I have a request form.  I want to let the user attach the file and send it out with the request. Please advise! Thank you!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Add FileUpload control om your page
'your previous code to process request
        If FileUpload1.HasFile Then
            Dim path = IO.Path.Combine(Server.MapPath("Data"),
                                       IO.Path.GetFileName(FileUpload1.PostedFile.FileName))
            Try
                FileUpload1.PostedFile.SaveAs(path)
                Response.Write("The file has been uploaded.")
            Catch ex As Exception
                Response.Write("Error: " & ex.Message)
            End Try
        End If

Open in new window

See MSDN article

Author

Commented:
Thank you! What  is FileUpload1 declared as? Could you give the complete code? Thank you!
FileUpload1 is default name of FileUpload control. Just drag'n'drop it from controls panel on your page. You can see complete example at https://docs.microsoft.com/en-us/previous-versions/ms227669(v=vs.140). Can you show tour markup and code behind?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial