MaxBytes Property

 Object: SoftArtisans.FileUp
 Syntax: MaxBytes
 Type: Long Integer
 Read/Write: Read/Write
 Description: This property defines the maximum number of bytes that are written to disk or into the database on a per-file basis.

This important property prevents malicious users from filling your web server's hard disk.
If a user uploads a file larger than MaxBytes, no error is reported. Instead, writing stops 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 are written to the web server's hard disk.

Each individual file in the upload has 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


Setting MaxBytes to zero (0) implies no limit.

You can also use MaxBytes in conjunction with the SaveBinaryAs method.

Example:

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

 

Previous Page Next Page