The MaxBytes property allows you to set the maximum size of the file to stored
on the web server. This property prevents malicious or uninformed users from
filling up the disk of the web server.
Like the Path property, MaxBytes must be set before referencing
any form elements. As soon as a form element is referenced, the upload will be
processed and files will be written to disk. If MaxBytes is set after referencing
a form element, it will be ignored, i.e.
set oUpl = Server.CreateObject("SoftArtisans.FileUp")
'--- The entire upload will be processed here. Cache files are written now.
myname = oUpl.Form("myname")
'--- WRONG: This will have no effect. It is too late, as the files are already written.
oUpl.MaxBytes = 500000
oUpl.SaveAs "c:\uploads\myfile.ext"
Instead, MaxBytes should be set immediately after instanciating
SA-FileUp, i.e.
set oUpl = Server.CreateObject("SoftArtisans.FileUp")
'--- RIGHT: Set MaxBytes before referencing the form.
oUpl.MaxBytes = 500000
'--- The entire upload will be processed here. Cache files are written now
myname = oUpl.Form("myname")
oUpl.SaveAs "c:\uploads\myfile.ext"
|