123 Eng

Engineering the engineers™

Latest Jobs   Forum Map



Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)


   Computer Science / IT






   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs



Terms of use

Displaying  Source Code(s)  

Limiting the Upload Size


Description : SA-FileUp's MaxBytes property allows you to limit the size of files uploaded to your server. If MaxBytes is set, SA-FileUp will stop writing to the hard disk when the value of MaxBytes is reached. For example, if MaxBytes = 1000, only 1000KB of a 100,000KB file will be written to the server hard disk. Set MaxBytes once and it will apply to all files in the current upload, limiting each of them to the value that you specify.

Using MaxBytes, you can prevent malicious users from filling your web server's hard disk.

<title>Limit File Size</title>
Thank you For uploading your file.

<% Set upl = Server.CreateObject(SoftArtisans.FileUp) %>
<% upl.MaxBytes = 1000 '--- limit the upload size to 1000 bytes %>
The maximum file size that you are permitted To upload Is <%=upl.MaxBytes%> bytes.

<% upl.SaveAs C: empupload.out %>
Total Bytes Written: <%=upl.TotalBytes%>

Server File Name: <%=upl.ServerName%>

Total Bytes Transmitted: <%=Request.TotalBytes%>

Restricting File Types
Use SA-FileUp's ContentType property and a Select condition to save only files of a specific type.

<title>Limit File Type</title>
<% Set upl = Server.CreateObject("SoftArtisans.FileUp")

'--- Parse out the file name
FName = Mid(upl.UserFilename, InStrRev(upl.UserFilename, ) + 1)

'--- Retrieve the file's content type and assign it to a variable
FCONT = upl.ContentType

'--- Restrict the file types saved using a Select condition
Select Case LCase(FCONT)
Case "image/gif"
Response.Write <P> & FName & has been saved.

Case image/pjpeg
Response.Write <P> & FName & has been saved.

Case Else
Response.Write <P> & You may only upload gif And jpeg files.<BR>
End Select




Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG