whisper_101 1 Light Poster

Hi Guys,

The code below allows me to upload images. How would I go about inserting error checking if the user uploads a word document for example?

Thanks

W

<!-- #INCLUDE FILE="Openconnection-for-local-use.asp" -->
<!--#include file="Upload.asp" --> 
<%

Dim Uploader, File
Set Uploader = GetASPUploader

Set File = Uploader.AddFile("file") 

File.ValidFileTypes = "jpg,gif,bmp"
File.MaxSize = 1024*1024
File.Overwrite = false 

Uploader.Destination = "C:\TestArea\imageUpload\files\"

Server.ScriptTimeout = 900

On Error Resume Next

Uploader.Upload

If Err Then 
  Response.Write err.description
  Response.End()
End If

Dim myFile, myDescrition
myFile=File.Name
myDescription=Uploader.Form("description")

StrSQL=  "INSERT INTO tblUploadedFiles ( filename, description ) VALUES ( '" & File.Name & "', '" & Uploader.Form("description") & "' ) "

Conn.Execute(StrSQL)

Set Uploader=Nothing 

Sub sImageProperties(vImage)
  Dim image, fs
  Set fs=CreateObject("Scripting.FileSystemObject")
  If Not fs.fileExists(vImage) Then Exit Sub
  Set image = loadpicture(vImage)
  myWidth = Round(image.width / 26.4583)
  myHeight = Round(image.height / 26.4583)
  Set image = Nothing
  Set fs=Nothing
End Sub
%>