Upload med aspupload
Jeg sender en ID med over til siden hvor man kan vælge at uploade et nyt billed, denne ID er en hidden value. når man så trykker på gem var ideen at den skulle kalde siden upload.asp og gemme det nye billed men det gør den ikke jeg får tværtimod fejlen:1 -- \'udsigt.jpg\',\'1\'
Persits.Upload.1 error \'800a001c\'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/aj/aj2/admin/upload.asp, line 60
linie 60 er her:
File.ToDatabase \"DRIVER={Microsoft Access Driver (*.mdb)};\" & \"DBQ=e:\\rc-internet\\AJ\\aj2\\db\\alfred.mdb\", \"insert into el(ID, El_billed) values(\" & Filstienkort & \"\',\'\" & uploadvaerdi & \")\"
min upload side ser sådan ud:
<% @Language=VBScript %>
<% Option Explicit %>
<!--#include file=\"adovbs.inc\"-->
<!--#include file=\"connection.asp\"-->
<%
Dim RS, objConn, ID
\'Get the ID from the querystring
ID = trim(request.querystring(\"ID\"))
Set RS = objConn.execute(\"SELECT * FROM data WHERE ID = \" & ID & \" \" )
%>
<html>
<head>
<title>Opret ny </title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
</head>
<body>
<FORM METHOD=\"POST\" ENCTYPE=\"multipart/form-data\" ACTION=\"upload.asp\">
<table width=\"592\" border=\"0\">
<tr valign=\"bottom\">
<td class=\"broed_over\">Billed:<br>
</td>
<td colspan=\"2\">
<input type=FILE size=60 name=\"El_billed\">
<input type=\"hidden\" name=\"ID\" value=\"<%=ID%>\">
</td>
</tr>
<tr>
<td> </td>
<td colspan=\"2\"></td>
</tr>
<tr>
<td> </td>
<td colspan=\"2\">
<input type=\"submit\" value=\"Gem\">
</td>
</tr>
</table>
</form>
<%
rs.close
set rs = nothing
objConn.close
set objConn = nothing
%>
</body>
</html>
siden der skal uploade billedet ser sådan ud:
<%
Set Upload = Server.CreateObject(\"Persits.Upload.1\")
Upload.Save \"e:/rc-internet/AJ/aj2/images\"
\' ++++++++++++++++++++++++++++++++++ HENTER STIEN+FILNAVN ++++++++++++++++++++++++++++++++
For Each File in Upload.Files
Filstien = File.Path
Next
For Each Item in Upload.Form
if antalupload > 0 then
uploadvaerdi = uploadvaerdi & \"\',\'\"
end if
uploadvaerdi = uploadvaerdi & Item.Value
antalupload = antalupload + 1
Next
uploadvaerdi = uploadvaerdi & \"\'\"
\' ++++++++++++++++++++++++++++++++++ HENTER STIEN+FILNAVN SLUT ++++++++++++++++++++++++++++++++
\' ++++++++++++++++++++++++++++++++++ FJERN STIEN ++++++++++++++++++++++++++++++++
Function RemoveHTML(strContent)
Do
pos = 1
\' +++++++++++++++++++++++ HER SKRIVES \"DREVBOGSTAV :\"
tmpBegin = InStr(pos,strContent,\"e:\")
\' +++++++++++++++++++++++ HER SKRIVES \"DREVBOGSTAV :\" SLUT
If tmpBegin > 0 Then
pos = tmpBegin
\' +++++++++++++++++++++++ HER SKRIVES \"SIDSTE DIR\" OG ANTALLET AF TEGN SKRIVES I NÆSTE LINIE
tmpEnd = InStr(pos,strContent,\"/images\")
tmpEnd = tmpEnd + 7
\' +++++++++++++++++++++++ HER SKRIVES \"SIDSTE DIR\" SLUT
If tmpEnd > 0 Then
strContent = Left(strContent,tmpBegin-1) & \"\" & Right(strContent,Len(strContent)-tmpEnd)
Else
strContent = Left(strContent,tmpBegin-1)
Exit Do
End If
Else
Exit Do
End If
Loop
RemoveHTML = strContent
End Function
tmpContent = Trim(Filstien)
Filstienkort = Replace(RemoveHTML(tmpContent), vbCrLf, \"\")
filstienkort = \"\'\" & filstienkort
\' ++++++++++++++++++++++++++++++++++ FJERN STIEN SLUT ++++++++++++++++++++++++++++++++
\' ++++++++++++++++++++++++++++++++++ GEMMER SIDSTE STI+FILNAVN ++++++++++++++++++++++++++++++++
\' Save to the database using the ToDatabase method.
\' SQL Server table creation script can be found in Database\\CreateTables.sql
response.write antalupload & \" -- \" & Filstienkort & \"\',\'\" & uploadvaerdi
For Each File in Upload.Files
File.ToDatabase \"DRIVER={Microsoft Access Driver (*.mdb)};\" & \"DBQ=e:\\rc-internet\\AJ\\aj2\\db\\alfred.mdb\", \"insert into el(ID, El_billed) values(\" & Filstienkort & \"\',\'\" & uploadvaerdi & \")\"
Next
\' ++++++++++++++++++++++++++++++++++ GEMMER SIDSTE STI+FILNAVN SLUT ++++++++++++++++++++++++++++++++
\' ++++++++++++++++++++++++++++++++++++++++++++++++++ OPRETTER I DATABASE
%>
<html>
<head>
<title>Fedest</title>
</head>
<body bgcolor=\"#FFFFFF\">
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" height=\"100%\">
<tr>
<td height=\"100%\">
<h5 align=\"center\">Din opdatering er nu udført :-)</h5>
</td>
</tr>
</table>
</body>
</html>
Jeg kan også se at siden der skal uploade billedet ikke checker at der hvor billedet skal sættes ind skal ID være = ID fra den hidden value.
Er der en der kan hjælpe ??