Posts

Showing posts with the label File Uploading

File Uploading In ASP.NET

In this article we are reading about  “ File Uploading In ASP.NET ” . The FileUpload control allows the user to browse for and select the file to be uploaded, providing a browse button and a text box for entering the filename. With ASP.NET, accepting file uploads from users has become extremely easy. With the FileUpload control, it can be done with a small amount of code lines, as you will see in the following example. However, please notice that there are security concerns to to consider when accepting files from users! Here is the markup required: 1 2 3 4 < form id = "form1" > & nbsp ; </ form > And here is the CodeBehind code required to handle the upload: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 protected   void  UploadButton_Click ( object  sender, EventArgs e ) { if ( FileUploadControl . HasFile ) { try { string  filename  =  Path . GetFileName ( FileUploadControl . FileName ) ; Fil...