Hello,<BR><BR> I am trying to use a form to upload .jpg images to a datbase, and I am having a hard time figuring out how to use ASP to check to make sure that the file is of .jpg type. I get this error:<BR><BR>Microsoft VBScript runtime error &#039;800a01a8&#039; <BR>Object required: &#039;&#039; <BR>/hircc/members/upload_pic1.asp, line 24 <BR><BR>Here is my code:<BR><BR>&#060;%@ Language=VBScript %&#062;<BR>&#060;%Option Explicit%&#062;<BR>&#060;!-- #include file="inc_imageupload.asp" --&#062;<BR>&#060;!--#include file="opendb.asp"--&#062;<BR>&#060;%<BR><BR><BR>&#039; Create the FileUploader<BR>Dim Uploader, File<BR>Set Uploader = New FileUploader<BR><BR>&#039; This starts the upload process<BR>Uploader.Upload()<BR><BR>&#039; Use [FileUploader object].Form to access <BR>&#039; additional form variables submitted with<BR>&#039; the file upload(s). (used below)<BR>Response.Write "&#060;b&#062;Thank you for your upload&#060;/b&#062;<BR>"<BR>&#039; Check if any files were uploaded<BR>If Uploader.Files.Count = 0 Then<BR> Response.Write "File(s) not uploaded."<BR>Else<BR> <BR> If File.ContentType = .jpg Then<BR> If File.FileSize &#060;= 50000 Then<BR> If Uploader.Form("saveto") = "database" Then<BR> <BR> &#039; Open the table you are saving the file to<BR> Dim RS<BR> dim strFirstName<BR> dim strLastName<BR> dim strSQL<BR><BR> strFirstName = Request.QueryString("FirstName") <BR> strLastName = Request.Querystring("LastName") <BR> strSQL = "SELECT * FROM [membersrides] WHERE FirstName =&#039;" & strFirstName & "&#039; AND LastName = &#039;" & strLastName & "&#039;" <BR> set RS = Server.CreateObject("ADODB.Recordset") <BR> RS.open strSQL, objConn, adOpenKeyset, adLockOptimistic, adCmdText <BR> <BR> RS("PictureOne") = File.FileName<BR> <BR> &#039; Save the file to the database<BR> File.SaveToDatabase RS("PictureOne")<BR> <BR> &#039; Commit the changes and close<BR> RS.Update<BR> RS.Close<BR> End If<BR> <BR> &#039; Output the file details to the browser<BR> Response.Write "File Uploaded: " & File.FileName & "<BR>"<BR> Response.Write "Size: " & File.FileSize & " bytes<BR>"<BR> Response.Write "Type: " & File.ContentType & "<BR><BR>"<BR>End If<BR>End If<BR>End If<BR>%&#062;<BR><BR>&#060;!--#include file="closedb.asp"--&#062;<BR><BR>&#060;%<BR>Response.Redirect "/hircc/members/form_pics2.asp?FirstName=" & strFirstName & "&LastName=" & strLastName<BR>%&#062;<BR><BR><BR>Here is the inc_imageupload.asp:<BR><BR>lass FileUploader<BR> Public Files<BR> Private mcolFormElem<BR><BR> Private Sub Class_Initialize()<BR> Set Files = Server.CreateObject("Scripting.Dictionary")<BR> Set mcolFormElem = Server.CreateObject("Scripting.Dictionary")<BR> End Sub<BR> <BR> Private Sub Class_Terminate()<BR> If IsObject(Files) Then<BR> Files.RemoveAll()<BR> Set Files = Nothing<BR> End If<BR> If IsObject(mcolFormElem) Then<BR> mcolFormElem.RemoveAll()<BR> Set mcolFormElem = Nothing<BR> End If<BR> End Sub<BR><BR> Public Property Get Form(sIndex)<BR> Form = ""<BR> If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex))<BR> End Property<BR><BR> Public Default Sub Upload()<BR> Dim biData, sInputName<BR> Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos<BR> Dim nPosFile, nPosBound<BR><BR> biData = Request.BinaryRead(Request.TotalBytes)<BR> nPosBegin = 1<BR> nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))<BR> <BR> If (nPosEnd-nPosBegin) &#060;= 0 Then Exit Sub<BR> <BR> vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)<BR> nDataBoundPos = InstrB(1, biData, vDataBounds)<BR> <BR> Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))<BR> <BR> nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))<BR> nPos = InstrB(nPos, biData, CByteString("name="))<BR> nPosBegin = nPos + 6<BR> nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))<BR> sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))<BR> nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))<BR> nPosBound = InstrB(nPosEnd, biData, vDataBounds)<BR> <BR> If nPosFile &#060;&#062; 0 And nPosFile &#060; nPosBound Then<BR> Dim oUploadFile, sFileName<BR> Set oUploadFile = New UploadedFile<BR> <BR> nPosBegin = nPosFile + 10<BR> nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))<BR> sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))<BR> oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))<BR><BR> nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))<BR> nPosBegin = nPos + 14<BR> nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))<BR> <BR> oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))<BR> <BR> nPosBegin = nPosEnd+4<BR> nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2<BR> oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)<BR> <BR> If oUploadFile.FileSize &#062; 0 Then Files.Add LCase(sInputName), oUploadFile<BR> Else<BR> nPos = InstrB(nPos, biData, CByteString(Chr(13)))<BR> nPosBegin = nPos + 4<BR> nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2<BR> If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))<BR> End If<BR><BR> nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)<BR> Loop<BR> End Sub<BR><BR> &#039;String to byte string conversion<BR> Private Function CByteString(sString)<BR> Dim nIndex<BR> For nIndex = 1 to Len(sString)<BR> CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1)))<BR> Next<BR> End Function<BR><BR> &#039;Byte string to string conversion<BR> Private Function CWideString(bsString)<BR> Dim nIndex<BR> CWideString =""<BR> For nIndex = 1 to LenB(bsString)<BR> CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1))) <BR> Next<BR> End Function<BR>End Class<BR><BR>Class UploadedFile<BR> Public ContentType<BR> Public FileName<BR> Public FileData<BR> <BR> Public Property Get FileSize()<BR> FileSize = LenB(FileData)<BR> End Property<BR><BR> Public Sub SaveToDisk(sPath)<BR> Dim oFS, oFile<BR> Dim nIndex<BR> <BR> If sPath = "" Or FileName = "" Then Exit Sub<BR> If Mid(sPath, Len(sPath)) &#060;&#062; "\" Then sPath = sPath & "\"<BR> <BR> Set oFS = Server.CreateObject("Scripting.FileSystemObject")< BR> If Not oFS.FolderExists(sPath) Then Exit Sub<BR> <BR> Set oFile = oFS.CreateTextFile(sPath & FileName, True)<BR> <BR> For nIndex = 1 to LenB(FileData)<BR> oFile.Write Chr(AscB(MidB(FileData,nIndex,1)))<BR> Next<BR><BR> oFile.Close<BR> End Sub<BR> <BR> Public Sub SaveToDatabase(ByRef oField)<BR> If LenB(FileData) = 0 Then Exit Sub<BR> <BR> If IsObject(oField) Then<BR> oField.AppendChunk FileData<BR> End If<BR> End Sub<BR><BR>End Class<BR>%&#062;<BR><BR><BR>Anyone know what I did wrong? I am new to this and have no idea what I am doing.<BR><BR>Tom -<BR><BR><BR>