Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit the size of pictures being up loaded

Status
Not open for further replies.

shawntbanks

Programmer
Oct 29, 2003
48
CA
any seggustions on how to limit the size of an image being uploaded to a server.
 
give this a try

<%
Set Upload = Server.CreateObject(&quot;Persits.Upload&quot;)
' Limit file size to 50000 bytes, throw an exception if file is larger
Upload.SetMaxSize 50000, True

' Intercept all exceptions to display user-friendly error
On Error Resume Next

' Perform upload
Upload.Save &quot;c:\upload&quot;

' 8 is the number of &quot;File too large&quot; exception
If Err.Number = 8 Then
Response.Write &quot;Your file is too large. Please try again.&quot;
Else
If Err <> 0 Then
Response.Write &quot;An error occurred: &quot; & Err.Description
Else
Response.Write &quot;Success!&quot;
End If
End If
%>


logo.gif width='85' height='30'

bath.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top