Go to AspUpload.com Web Site

AspUpload 2.1

User Manual


Getting Started

Working with FILES and FORM Collections Setting a Limit on File Size Forcing Unique File Names Image Size and Type Extraction (improved in AspUpload 2.1)
AspUpload 2.1 is capable of obtaining image size information from GIF, JPEG, PNG and BMP files via the properties UploadedFile.ImageWidth and UploadedFile.ImageHeight. You can use these properties to limit the size of uploaded images. To determine the type of an uploaded image, you may use the property UploadedFile.ImageType which returns the strings "GIF", "JPG", "PNG" or "BMP" for GIF, JPEG, PNG and BMP files, respectively. If an uploaded file is not an image or its type cannot be determined, this property returns the string "UNKNOWN". The following example demonstrates the usage of these properties (another example can be found in the sample file UploadScript7.asp):

Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.Save(Server.Mappath ("./"))
For Each File in Upload.Files

If File.ImageType <> "GIF" and File.ImageType <> "JPG" Then
  Response.Write "GIF or JPG files only please!"
  Exit For
End If

If File.ImageWidth > 150 Then
  Response.Write "Image width cannot exceed 150 pixels."
  Exit For
End If

If File.ImageHeight > 200 Then
  Response.Write "Image height cannot exceed 200 pixels."
  Exit For
End If