ASPUpload isn't working with WebApplication

I bought this web application its supposed to be ready to use, with minor changes, but my images wont upload...
OS: SBS2003
Components: ASPUpload, ASPmail
Database: SQL Server 2000

Here is a copy of the Uploader ASP Code:
<%
Class FileUploader
      Public  Files
      Private mcolFormElem

      Private Sub Class_Initialize()
            Set Upload = Server.CreateObject("Persits.Upload")
            Set mcolFormElem = Server.CreateObject("Scripting.Dictionary")
      End Sub
      
      Private Sub Class_Terminate()
            If IsObject(Files) Then
                  Files.RemoveAll()
                  Set Files = Nothing
            End If
            If IsObject(mcolFormElem) Then
                  mcolFormElem.RemoveAll()
                  Set mcolFormElem = Nothing
            End If
      End Sub

      Public Property Get Form(sIndex)
            Form = ""
            If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex))
      End Property

      Public Default Sub Upload()
            Dim biData, sInputName
            Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos
            Dim nPosFile, nPosBound

            biData = Request.BinaryRead(Request.TotalBytes)
            nPosBegin = 1
            nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
            
            If (nPosEnd-nPosBegin) <= 0 Then Exit Sub
             
            vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
            nDataBoundPos = InstrB(1, biData, vDataBounds)
            
            Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))
                  nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))
                  nPos = InstrB(nPos, biData, CByteString("name="))
                  nPosBegin = nPos + 6
                  nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
                  sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                  nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))
                  nPosBound = InstrB(nPosEnd, biData, vDataBounds)

                  If nPosFile <> 0 And  nPosFile < nPosBound Then
                        Dim oUploadFile, sFileName
                        Set oUploadFile = New UploadedFile

                        nPosBegin = nPosFile + 10
                        nPosEnd =  InstrB(nPosBegin, biData, CByteString(Chr(34)))
                        sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                        oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))

                        nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))
                        nPosBegin = nPos + 14
                        nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
                        
                        oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                        
                        nPosBegin = nPosEnd+4
                        nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
                        oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
                        
                        If oUploadFile.FileSize > 0 Then                               
                              Files.Add LCase(sInputName), oUploadFile
                        end if

                  Else
                        nPos = InstrB(nPos, biData, CByteString(Chr(13)))
                        nPosBegin = nPos + 4
                        nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
                        If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                  End If

                  nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)
            Loop
      End Sub

      'String to byte string conversion
      Private Function CByteString(sString)
            Dim nIndex
            For nIndex = 1 to Len(sString)
               CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1)))
            Next
      End Function

      'Byte string to string conversion
      Private Function CWideString(bsString)
            Dim nIndex
            CWideString =""
            For nIndex = 1 to LenB(bsString)
               CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1)))
            Next
      End Function
End Class

Class UploadedFile
      Public ContentType
      Public FileName
      Public FileData
      
      Public Property Get FileSize()
            FileSize = LenB(FileData)
      End Property

      Public Sub SaveToDisk(sPath, SaveFileName)
            Dim oFS, oFile
            Dim nIndex
      
            If sPath = "" Or FileName = "" Then Exit Sub
            If Mid(sPath, Len(sPath)) <> "\" Then sPath = sPath & "\"
      
            Set oFS = Server.CreateObject("Scripting.FileSystemObject")
            If Not oFS.FolderExists(sPath) Then Exit Sub
            
            'SaveFileName = media_id & right(FileName,4)

            Set oFile = oFS.CreateTextFile(sPath & SaveFileName, True)
            
            For nIndex = 1 to LenB(FileData)
                oFile.Write Chr(AscB(MidB(FileData,nIndex,1)))
            Next

            oFile.Close
      End Sub
      
      Public Sub SaveToDatabase(ByRef oField)
            If LenB(FileData) = 0 Then Exit Sub
            
            If IsObject(oField) Then
                  oField.AppendChunk FileData
            End If
      End Sub

End Class
%>

And this is the page that returns a HTTP: 500 Internal Server Error: <<Permissions have been checked, and folders have read/write>>

<!-- #include file="../include/check_login.asp" -->
<!--#include file="../include/constants.asp" -->
<!-- #include file="../include/uploader.asp" -->
<!-- #include file="../include/database.asp" -->
<!-- #include file="../include/image.asp" -->
<%

Set Uploader = New FileUploader
Uploader.Upload()

agent_id =  uploader.form("agent_id")

MaxSize = 500000'500k

if Uploader.Files.Count > 0 then

      For Each File In Uploader.Files.Items
            
            FileName = File.FileName

            select case right(lcase(FileName), 4)
            case ".jpg", ".gif"
            case else
                  msg = right(FileName, 4) & " is not a valid file type."
            end select      

            if len(msg)=0 then
                  If File.fileSize <= MaxSize Then                  

                        SaveFileName = agent_id & "_" & FileName
                        call File.SaveToDisk(FilePath, SaveFileName)

                        'response.write FilePath & SaveFileName
                        'response.end

                        'resize
                        call CreateThumb(120, FilePath & SaveFileName, FilePath & SaveFileName)

                        sql = "update agent set pic='" & SaveFileName & "' where site_id=0" & site_id & " and agent_id=0" & agent_id
                        conn.execute(sql)

                        randomize
                        response.redirect("picture.asp?r=" & rnd & "&agent_id=" & agent_id)
                  else
                        msg = "The maximum file size allowed is " & MaxSize & "."
                        
                  End If
            end if
      Next
else
      msg = "Please select a file."
end if

%>

Please let me know if anyone can help, or if you need more info??
LVL 2
RICHARDloireAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

walkerkeCommented:
I don't have ASPUpload, but I've used a similar component. With it, it was necessary to give the anonymous user account read/write access to the folder the uploaded files were to be stored in. I believe the account name is IUSR_COMPUTERNAME. I'm at home and don't have access to my server from here to confirm this.
0
RICHARDloireAuthor Commented:
Thank you for you comment, those permissions have been set still not able to.
0
thefritterfatboyCommented:
>>And this is the page that returns a HTTP: 500 Internal Server Error: <<Permissions have been checked, and folders have read/write>><<

Unfortunately - this error message is no use to us. Could you please turn "friendly error messages" off in your browser. I'm assuming you're using IE - if so go to Tools >> Internet Options >> Advanced and look for the friendly error messages option and ensure it is turned off - once this is done - the error message you see on your upload pages should be much more specific.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

peterxlaneCommented:
Definitely turn off the friendly error messages...  But every time I see one of these questions in here, it always ends up being a permissions issue even when the question says that they checked the permissions...
0
RICHARDloireAuthor Commented:
Sorry.... here is the actual error:

Microsoft VBScript runtime error '800a01f5'

Illegal assignment: 'Upload'

G:\DAVEKRICK\REALTYWEBSITE\WWWROOT\ADMIN\../include/uploader.asp, line 7
0
peterxlaneCommented:
I stand corrected... it looks like this is not a permissions issue (as far as I can tell).

I am guessing that somewhere outside of the class, you have a subroutine called upload.  The following code will reproduce your error:

<%
Class FileUploader
     Private Sub Class_Initialize()
          Set Upload = Server.CreateObject("ADODB.Connection")
     End Sub
End Class

Sub Upload
      Response.Write "hello"
End Sub

Set Upload = New FileUploader
%>

You need to rename on or the other...
0
RICHARDloireAuthor Commented:
sorry don't get what your trying to tell me. I'm a novice to ASP and programming; Networking on the other hand...
0
peterxlaneCommented:
Basically, you will need to search through all your code for a routine that is called upload.  My hunch is that there is one somewhere that does something.  

If the subroutine is there, then VBScript won't let you use a line like "Set Upload", because it is trying to set a variable to an already defined subroutine.

Basically open up all of your files and search for "Sub Upload" or "Function Upload" and when you find it, you just need to change it's name to something else, even just "Sub Upload2" would do the trick.  You then just need to make sure that any place that you were calling that subroutine gets updated to reflect the new name.

0
RICHARDloireAuthor Commented:
I get another error?

Microsoft VBScript runtime error '800a01b6'

Object doesn't support this property or method: 'Uploader.Upload'

/admin/picture_upload.asp, line 9
 
here's that section that has line 9:

<%

Set Uploader = New FileUploader
Uploader.Upload()

agent_id =  uploader.form("agent_id")

MaxSize = 500000'500k

if Uploader.Files.Count > 0 then

      For Each File In Uploader.Files.Items
            
            FileName = File.FileName

            select case right(lcase(FileName), 4)
            case ".jpg", ".gif"
            case else
                  msg = right(FileName, 4) & " is not a valid file type."
            end select      

            if len(msg)=0 then
                  If File.fileSize <= MaxSize Then                  

                        SaveFileName = agent_id & "_" & FileName
                        call File.SaveToDisk(FilePath, SaveFileName)

                        'response.write FilePath & SaveFileName
                        'response.end

                        'resize
                        call CreateThumb(120, FilePath & SaveFileName, FilePath & SaveFileName)

                        sql = "update agent set pic='" & SaveFileName & "' where site_id=0" & site_id & " and agent_id=0" & agent_id
                        conn.execute(sql)

                        randomize
                        response.redirect("picture.asp?r=" & rnd & "&agent_id=" & agent_id)
                  else
                        msg = "The maximum file size allowed is " & MaxSize & "."
                        
                  End If
            end if
      Next
else
      msg = "Please select a file."
end if

%>
0
peterxlaneCommented:
What was the subroutine that you found and renamed?

0
RICHARDloireAuthor Commented:
Here's the only page with the text u stated above (just scroll down you'll see my marker). Change was from Upload to Upload1.

<%
Class FileUploader
      Public  Files
      Private mcolFormElem

      Private Sub Class_Initialize()
            Set Upload = Server.CreateObject("Persits.Upload")
            Set mcolFormElem = Server.CreateObject("Scripting.Dictionary")
      End Sub
      
      Private Sub Class_Terminate()
            If IsObject(Files) Then
                  Files.RemoveAll()
                  Set Files = Nothing
            End If
            If IsObject(mcolFormElem) Then
                  mcolFormElem.RemoveAll()
                  Set mcolFormElem = Nothing
            End If
      End Sub

      Public Property Get Form(sIndex)
            Form = ""
            If mcolFormElem.Exists(LCase(sIndex)) Then Form = mcolFormElem.Item(LCase(sIndex))
      End Property

      Public Default Sub Upload1()  <---------------------------------------------------------------------------This one*********************************
            Dim biData, sInputName
            Dim nPosBegin, nPosEnd, nPos, vDataBounds, nDataBoundPos
            Dim nPosFile, nPosBound

            biData = Request.BinaryRead(Request.TotalBytes)
            nPosBegin = 1
            nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
            
            If (nPosEnd-nPosBegin) <= 0 Then Exit Sub
             
            vDataBounds = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
            nDataBoundPos = InstrB(1, biData, vDataBounds)
            
            Do Until nDataBoundPos = InstrB(biData, vDataBounds & CByteString("--"))
                  nPos = InstrB(nDataBoundPos, biData, CByteString("Content-Disposition"))
                  nPos = InstrB(nPos, biData, CByteString("name="))
                  nPosBegin = nPos + 6
                  nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(34)))
                  sInputName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                  nPosFile = InstrB(nDataBoundPos, biData, CByteString("filename="))
                  nPosBound = InstrB(nPosEnd, biData, vDataBounds)

                  If nPosFile <> 0 And  nPosFile < nPosBound Then
                        Dim oUploadFile, sFileName
                        Set oUploadFile = New UploadedFile

                        nPosBegin = nPosFile + 10
                        nPosEnd =  InstrB(nPosBegin, biData, CByteString(Chr(34)))
                        sFileName = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                        oUploadFile.FileName = Right(sFileName, Len(sFileName)-InStrRev(sFileName, "\"))

                        nPos = InstrB(nPosEnd, biData, CByteString("Content-Type:"))
                        nPosBegin = nPos + 14
                        nPosEnd = InstrB(nPosBegin, biData, CByteString(Chr(13)))
                        
                        oUploadFile.ContentType = CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                        
                        nPosBegin = nPosEnd+4
                        nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
                        oUploadFile.FileData = MidB(biData, nPosBegin, nPosEnd-nPosBegin)
                        
                        If oUploadFile.FileSize > 0 Then                               
                              Files.Add LCase(sInputName), oUploadFile
                        end if

                  Else
                        nPos = InstrB(nPos, biData, CByteString(Chr(13)))
                        nPosBegin = nPos + 4
                        nPosEnd = InstrB(nPosBegin, biData, vDataBounds) - 2
                        If Not mcolFormElem.Exists(LCase(sInputName)) Then mcolFormElem.Add LCase(sInputName), CWideString(MidB(biData, nPosBegin, nPosEnd-nPosBegin))
                  End If

                  nDataBoundPos = InstrB(nDataBoundPos + LenB(vDataBounds), biData, vDataBounds)
            Loop
      End Sub

      'String to byte string conversion
      Private Function CByteString(sString)
            Dim nIndex
            For nIndex = 1 to Len(sString)
               CByteString = CByteString & ChrB(AscB(Mid(sString,nIndex,1)))
            Next
      End Function

      'Byte string to string conversion
      Private Function CWideString(bsString)
            Dim nIndex
            CWideString =""
            For nIndex = 1 to LenB(bsString)
               CWideString = CWideString & Chr(AscB(MidB(bsString,nIndex,1)))
            Next
      End Function
End Class

Class UploadedFile
      Public ContentType
      Public FileName
      Public FileData
      
      Public Property Get FileSize()
            FileSize = LenB(FileData)
      End Property

      Public Sub SaveToDisk(sPath, SaveFileName)
            Dim oFS, oFile
            Dim nIndex
      
            If sPath = "" Or FileName = "" Then Exit Sub
            If Mid(sPath, Len(sPath)) <> "\" Then sPath = sPath & "\"
      
            Set oFS = Server.CreateObject("Scripting.FileSystemObject")
            If Not oFS.FolderExists(sPath) Then Exit Sub
            
            'SaveFileName = media_id & right(FileName,4)

            Set oFile = oFS.CreateTextFile(sPath & SaveFileName, True)
            
            For nIndex = 1 to LenB(FileData)
                oFile.Write Chr(AscB(MidB(FileData,nIndex,1)))
            Next

            oFile.Close
      End Sub
      
      Public Sub SaveToDatabase(ByRef oField)
            If LenB(FileData) = 0 Then Exit Sub
            
            If IsObject(oField) Then
                  oField.AppendChunk FileData
            End If
      End Sub

End Class


%>
0
peterxlaneCommented:
Then you would need to change this line:
Uploader.Upload()

To:
Uploader.WHATEVERYOUNAMEDIT

Another possibility is to simply remove line 9:
Set Upload = Server.CreateObject("Persits.Upload")

Persits Upload is a third party component that would not need all of this other code.  Basically, you would use one or the other but not both.

0
RICHARDloireAuthor Commented:
tried both and still no luck, thank you though.
0
peterxlaneCommented:
Maybe a recap would help.  Can you post your CURRENT Uploader code and the page that was originally returning the 500 error code and what you are currently getting for an error message?  Was the ASPUpload working on it's own or did it break when you incorporated it into your existing code?

Or do you even possibly have all the code in a zip file that you could put somewhere that I could download it?

0
RICHARDloireAuthor Commented:
Here's all my coding.  I put everything back to the way it was:

www.davekrick.com/RealtyWebsite.zip

0
RICHARDloireAuthor Commented:
Fixed the problem.  I uninstalled the two server components that were giving me trouble (ASPupload, and ASPJpeg).  I then installed them back and everything is working like it should.  Please close this question..
0
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.