How do I upload a file using asp.net?

Answer by A Quora admin:

In order to upload a file using ASP. net, you need to follow the following steps.
1) In your .aspx page where you want to have your file upload functionality drag and drop the file upload control from the tool box.

2) Choose the event upon which you need to upload the file. In my example I have chosen to upload the file on a button click.

3) Now that I want my upload code need to be written in the Upload_Click event I go to the .aspx.cs page by double clicking on the Upload_Click action from the properties window and code as shown in the below screenshot.

4) For uploading the file to the server, replace the save Location path by the application server path where the user has access to. code to get the server path is Server.MapPath("Data") .

For further reading refer : Page on microsoft.com

Hope it helps. Happy coding!

How do I upload a file using asp.net?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s