Fejl i smartupload
HejJeg har denne kode hvor jeg vi uploade en fil og gemme nogle data til databasen.
Når jeg submitter, får jeg denne fejl:
Request object error 'ASP 0206 : 80004005'
Cannot call BinaryRead
/vote/upload.asp, line 83
Cannot call BinaryRead after using Request.Form collection.
----
Linie 83 er:
mySmartUpload.Upload
-----
<%If mode = "" then %>
Upload dit billede til #navn# her.<br><br>
<form method="post" action="default.asp?s=Upload&Mode=Upload" ENCTYPE="multipart/form-data" name="formupload">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="60">Billede</td>
<td><INPUT TYPE="FILE" NAME="FILE1" SIZE="50" class="input"></td>
</tr>
<tr>
<td>Navn</td>
<td><input type="text" class="input" value="" name="name"></td>
</tr>
<tr>
<td>Alder</td>
<td><input type="text" class="input" value="" name="age"></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" class="input" value="" name="email" ></td>
</tr>
<tr>
<td>Køn</td>
<td>
<input type="radio" value="Female" name="Sex" checked>Pige
<input type="radio" value="Male" name="Sex">Fyr</td>
</tr>
<tr>
<td>Land</td>
<td><select size="1" name="Country" class="input">
<option value="1">Danmark</option>
<option value="2">Norge</option>
<option value="3">Sverige</option>
</select></td>
</tr>
<tr>
<td valign="top">Kategori</td>
<td>
<input type="radio" value="1" name="Category" checked>Patter<br>
<input type="radio" value="2" name="Category">Numse<br>
<input type="radio" value="3" name="Category" >Krop</td>
</tr>
<tr>
<td> </td>
<td align="right"><a href="">Upload</a>
<br><input type="submit" value="Upload" class="input"></td>
</tr>
</table>
</td>
<td width="20"></td>
<td valign="top">
<u>Regler for billeder:</u><br>
1. Billedet skal være i .jpg format<br>
2. Billedet skal vise patter, numse eller krop<br>
3. Billedet skal være amatørbilleder<br>
4. Billedet må max fylde 100kb.<br>
5. #navn# tager ikke ansvar for billederne.<br>
</td>
</tr>
</table>
<%end if %><%
if mode = "Upload" then
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
'Response.Redirect "filename.asp"
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' ****************************************************************************
' sample with a physical path
'file.SaveAs("" & FYSISKsti & "filarkiv\" & mySmartUpload.Form("mappenavn") & file.FileName)
file.SaveAs("picturesorg/" & file.FileName)
'Tilføjer brugeren til databasen
Set rs = Server.CreateObject("ADODB.Recordset")
strSQL = "select * from pictures"
rs.Open strsql, conn, 1, 3
'Tilføjer brugeren til databasen og sender ham/hende til login siden
rs.AddNew
rs("Picfile") = file.FileName
rs("name") = mySmartUpload.Form("name")
rs("sex") = mySmartUpload.Form("sex")
rs("country") = mySmartUpload.Form("country")
rs("Category") = mySmartUpload.Form("category")
rs("Email") = mySmartUpload.Form("email")
rs("added") = now()
rs.update
intCount = intCount + 1
Response.Redirect "default.asp?S=Upload&mode=Done"
End If
' Display the number of files which could be uploaded
' ***************************************************
' Response.Write("<BR>" & mySmartUpload.Files.Count & " file(r) kunne blive uploaded.<BR>")
' Display the number of files uploaded
' ************************************
' Response.Write(intCount & " file(r) uploaded.<BR>")
Next
end if
%>
