file upload control in asp.net

fileupload control  in asp.net

 The fileupload control  enables  you to upload file to the server. It displayed a text control and a browse button that allow users to select a file upload to the server.

This control is used to upload any type of file . but we can set it only specific format of file ,  using some code writing behind it .

html code of fileupload control

The asp.net fileupload control is introduce in asp.net 2.0 framework that provides the advanced  functionality to the  users to sent a file from their computer to  the online web server.

It renders using HTML input type file control that appears as  combination of two control such as textbox control  and button control. The textbox control sends the path of the  file selected from the use’s computer to the server whereas button control provides the functionality to open a file-navigation dialog box. Users can  navigate between the directories and files available on their system and select a file that they  want to upload  to the web server.

 

The security  feature  of fileupload  control does  not allow , you  to specify the file path dynamically  and users are also not allowed to type-in the file path in the textbox field available  with fileupload control. Users have to browse the file  using file-navigation dialog box to select it for uploading.

 

Tha asp.net  fileupload  control provides different  types of  properties  that  enable you to examine the  characteristics of the uploaded file and save it to  a specific  location on the web server.

 

fileBytes  :-    it provides  the  access to the  bytes array generated  from the  stream of file selected by the user to upload.

FileContent:-  it provides the  Sysmte.IO.Stream  object  that  points to the file  specified for uploading. You  access all the methods and properties stream class that allows you to read or write the bytes array stream of the  file that is being upload  by the fileupload control.

FileName :-   it returns the  name of the  file selected by the user to upload using fileuplaod control.

SaveAs :-   the savesa method  of it provides   the functionality to save the uploaded file at the location specified in the code to write it in the server .

PostedFile :-    the postedFile  provides as object of httpPostedFile class that  points to the  single file that  have been upload  using FileUpload  control. It  provides the access to the  properties such  as ContentLength, ContentType, FileName, InputStream and SaveAs method.

The asp.net  FIleUpload   control caches  the entire contents of the  elected file from client’s computer system to the the server memory after finishing the caching process it move forward to execute the code specified in the web page.