CodeCharge Studio

FileSizeLimit Run-Time Property (ASP)

Applies to

FileUpload Component

Type

number

Access

read/write

Syntax

object.FileSizeLimit [=value]

Description

Specifies the maximum size (in bytes) of a file that can be uploaded to the server. If the size of the uploaded file is greater than value of this property, the upload fails and appropriate error message is displayed.
Note: the initial value of this property comes from the "File Size Limit" design-time property of the FileUpload component.

Example

The sample code below (inside the AfterInitialize event procedure of the page) sets a new file size limit for the file upload control (fu). The new value of the limit is taken from maxfilesize session variable. (Such variable can be set, for example, in the OnClick server-side event procedure of the Login button, after the user has been successfully authenticated):
Function Page_AfterInitialize() 
Dim mfs
  mfs = Session("maxfilesize")
  If Not IsEmpty(mfs) Then
       attachments.fu.FileSizeLimit = mfs
  End if

End Function 

See also

FileSize property


On-line, printable versions and updates