API Manual

TFileUpload displays a file upload field on a Web page. Upon postback, the text entered into the field will be treated as the (local) name of the file that is uploaded to the server.

TFileUpload raises an OnFileUpload event when it is post back. The property HasFile indicates whether the file upload is successful or not. If successful, the uploaded file may be saved on the server by calling saveAs() method.

The following properties give the information about the uploaded file:

  • FileName - the original client-side file name without directory information.
  • FileType - the MIME type of the uploaded file.
  • FileSize - the file size in bytes.
  • LocalName - the absolute file path of the uploaded file on the server. Note, this file will be deleted after the current page request is completed. Call saveAs() to save the uploaded file.

If the file upload is unsuccessful, the property ErrorCode gives the error code describing the cause of failure. See PHP documentation for a complete explanation of the possible error codes.