Class: SoftArtisans.FileUp

Property: MaxBytes

Type: long integer

Read/Write

Description: This property defines the maximum number of bytes that will be written to disk or into the database on a per-file basis.

This important property will prevent malicious users from filling your web server's hard disk.

If a user uploads a file larger than MaxBytes, no error will be reported. Instead, writing will stop at exactly that value. For example, if MaxBytes is set to 200, and the user uploads a file that is 300 bytes long, only the first 200 bytes will be written to the web server's hard disk.

Every individual file in the upload will have this limit. For example, if there are three files in a single form and MaxBytes is set to 500.

 File Original Size  Written Size
file1 1000 500
file2 200 200
file3 600 500

By default, MaxBytes is set to 2GB, effectively no limit.

Setting MaxBytes to zero (0) implies no limit.

MaxBytes can also be used in conjunction with SaveBinaryAs.

Example:

<%
	upl.MaxBytes = 300000
	upl.SaveAs filename
... %>