Fejl i brug af Chilikat ASP Upload til database
Har tidligere anvendt Persits til dette formål, men skal nu bruge Chilikat ASP Upload.Når siden kaldes, siger denne fejl:
Microsoft VBScript runtime error '800a01c3'
Object not a collection
/UploadScript.asp, line 46 (=For Each File in receiver.SaveToUploadDir)
Har ledt efter et konkret eks. på upload til database, men kan ikke finde det. Hjælp mig, tak!
---
her selve koden:
<% Response.Buffer = True %>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Welcome</title>
<link rel="stylesheet" href="../../../css/styles.css">
</head>
<body bgcolor="#ffffff" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="25"><img src="../../../images/ressourcer/clear.gif" width="25" height="32" border="0"></td>
<td>
<p></p>
</td>
</tr>
<tr>
<td width="25"></td>
<td>
<p><span class="header">Upload report:<br>
<br>
</span><span class="brodtekst"><%
' If the ultimate destination of uploaded files is a database,
' it makes sense to upload files to memory for better perfomance and security
'Set Upload = Server.CreateObject("Persits.Upload.1")
'Count = Upload.SaveToMemory
set receiver = Server.CreateObject("Chilkat.UploadRcv")
' Do not save uploads to the filesystem:
receiver.SaveToUploadDir = 0
' NOTE: when SaveToMemory is used, File.Path is the same as File.OriginalPath
ConnectStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("..\..\..\..\..\database\FilesCRA.mdb")
Set rs = Server.CreateObject("adodb.recordset")
rs.Open "LIST_PROJECTS", ConnectStr, 2, 3
'For Each File in Upload.Files
'For Each File in receiver.Files
For Each File in receiver.SaveToUploadDir
strHeader = Replace(Upload.Form("Header"),"'","%01")
rs.AddNew
rs("header").Value = strHeader
rs("Image1").Value = File.Binary
rs("Filename").Value = File.ExtractFileName 'get file name
rs("size").Value = File.Size
rs("time").Value = now
Response.Write "Path=" & File.Path & "<BR>Size=" & File.Size & "<BR>ContentType=" & File.ContentType
rs.Update
Next
rs.Close
set rs = nothing
'UPDATE FRONTPAGE
Conn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("..\..\..\..\..\database\frontpage.mdb")
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open "newfiles", Conn, 2, 3
objRec.AddNew
objRec("Header").Value = "Project List"
objRec("from").Value = "projects/list/"
objRec("base").Value = "projects/"
objRec.Update
objRec.Close
Set objRec = Nothing
%>
</span>
<span class="underheader"><br>Success! <% =Count %> file have been saved to the database.<br><br>
« <a href="Default.asp">Back to Project List.</a>
</span></p>
</td>
</tr>
</table>
</body>
</html>