Toon posts:

[ASP/MySQL] Probleem met upload naar database

Pagina: 1
Acties:
  • 60 views sinds 30-01-2008

Verwijderd

Topicstarter
Hoi ik heb een website gemaakt met asp voor onze scouting groep.
Nu had ik deze thuis op mijn win2000 draaien onder IIS en alles werkte perfect!
Nu hebben wij een hosting van ASP op een Cobalt Server en met MYSQL. Na heel
wat aanpassingen werkt bijna alles nu weer (CaseSensitive enz enz.) Ik heb alleen nog 1 probleem: Ik had in 2 tabbellen binaire bestanden staan. (foto's word docs etc.) deze laadde ik m.b.v. de webpagina in een access db. Nu met Mysql word dat wat moeilijk mijn script werkt niet meer :(

Nu heb ik 3 vragen:
- Als file type van een database veld in access ole object is, wat word het dan in MYSCQL? ik dacht BLOB of TinyBlob maar het script werkt dan nog niet :(

- Ik heb op internet gezocht naar Sites waar ik source codes van scripts kan downloaden voot MYSQL Specifiek. maar zonder resultaat, heeft iemand hier voor goede links?

- Het stukje script heb ik aangepast, maar loopt hier steeds vast herkent iemand het???

Ik heb een script uploaden.asp wat goed werkt, dit script maakt gebruik van uploaden_functies.asp hierin gaat het fout. uploaden_functies.asp ziet er zo uit:

ASP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<%
Class FileUploader
    Public  Files
    Private mcolFormElem

    Private Sub Class_Initialize()
        Set Files = Server.CreateObject("Scripting.Dictionary")
        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



'HIER GAAT HET FOUT:    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
            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 SaveToDatabase(ByRef oField)
        If LenB(FileData) = 0 Then Exit Sub
        
        If IsObject(oField) Then
            oField.AppendChunk FileData
        End If
    End Sub

End Class
%>


De error melding is:

Microsoft VBScript compilation error '800a0401'

Expected end of statement

uploaden_functies.asp, line 22

Public Property Get Form(sIndex)
----------------^

Ik hoop dat iemand mij kan helpen!

Alvast bedankt!

[ Voor 3% gewijzigd door Verwijderd op 03-02-2003 08:19 ]


  • ACM
  • Registratie: Januari 2000
  • Niet online

ACM

Software Architect

Werkt hier

Verwijderd schreef op 02 februari 2003 @ 22:39:
Nu heb ik 3 vragen:
- Als file type van een database veld in access ole object is, wat word het dan in MYSCQL? ik dacht BLOB of TinyBlob maar het script werkt dan nog niet :(

Tinyblob = 256bytes, das waarsch wat te krap. Maar blob is idd het binary-opslag-formaat van mysql.

Ik kan je heel simpel in php laten zien hoe je ermee kan werken, maar daar heb je niks aan dus dat doe ik maar niet :)

Plaats trouwens es code-tags ([code=asp] en dan verderop [/code] bijv) rond je code?

  • Gert
  • Registratie: Juni 1999
  • Laatst online: 05-12-2025
Ik dacht dat Chilisoft nog geen classes ondersteunde? :o

  • eek
  • Registratie: Februari 2001
  • Laatst online: 06-04-2020

eek

@MagickNET

get_form ????

Skill is when luck becomes a habit.


Verwijderd

Topicstarter
Ik kan je heel simpel in php laten zien hoe je ermee kan werken, maar daar heb je niks aan dus dat doe ik maar niet
ik ken een heel klein beetje php, is het hierin heel makkelijk om binaire bestanden in de database te laden? Anders ga ik dat gewoon doen!

  • Scharnout
  • Registratie: November 2000
  • Laatst online: 23-08 12:39

Scharnout

Meuk

Heb je wel schrijfrechten?

And Bob's your uncle ...


Verwijderd

Topicstarter
Ja ik heb wel schrijfrechten, dus dat is het probleem niet. Het is inderdaad het probleem met de class modules! Ik zal dus ergens anders een scipt vandaan moeten toveren die wel werkt op MYSQL om daarmee binaire data in een database te laden

  • Gert
  • Registratie: Juni 1999
  • Laatst online: 05-12-2025
Het ligt niet aan MySql maar aan de gebruike software om de vbscode uit te voeren. Je moet dus op zoek naar iets dat op ASP2.0 werkt en niet afhankelijk is van elementen die pas in ASP3.0 te vinden zijn, zoals classes.

  • Glimi
  • Registratie: Augustus 2000
  • Niet online

Glimi

Designer Drugs

(overleden)
Veel succes met zoeken van het script. Onthoud wel dat we in princiepe geen support forum zijn voor derdehands scripts :)
Pagina: 1

Dit topic is gesloten.