Sunday 7 April 2013

FileUpload Control

This control is used to allow the user to select the files and upload them to the server.

Properties of FileUpload Control:
  • AllowMultiple: This is Boolean property & when it is set to true you can select and upload multiple files and when it is set to false then you can select and upload only one file.
  • FileBytes: Returns total content of the file in the form of byte array.
  • FileContent: Returns a string object using which you can read data from the file or write data to the file.
  • FileName: Returns name and path of the selected file.
  • HasFile: This is a Boolean property and it is used to determine whether or not atleast one file is selected in FileUpload.
  • HasFiles: Used to determine whether or not multiple files are selected withen the FileUpload Control.
  • PostedFiles: Returns the first file selected in the FileUpload.
 Method of FileUpload Control:
  • SaveAs: Used to save the selected file onto the server.