Wickmark Medlem sedan juli 2003 162 inlägg Frågan 28 nov. 2003 13:58 #1 Hej,
Jag har hittat en hel del trådar om just detta jag kommer ta upp, men ingen av dem har fått mig att fatta, eftersom koden fortfarande crashar.
Felmeddelandet är:
Object required
o klagar på rad 14
Koden är:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include virtual="/LWSWE/adovbs.inc"-->
<% if Session("type") = "admin" then
dim strCAPTION, strTEXT, strPOSTER
dim datDATE
dim intFORUM, intTHREAD, intSMILIES, intPOSTER_ID, intSIGNATURE, intID
dim uplFILE
dim Upload, Conn, RecSet, File
Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save ""&Server.MapPath("/LWSWE/3FactionAnphillia/upload")
Set File = Upload.Files("file")
strPath = File.Path [red][b]'<---Detta är rad 14[/b][/red]
if strPath <> "" then
uplFILE = Right(strPath, Len(strPath) - InStrRev(strPath, "\", -1, 1))
else
uplFILE = ""
end if
datDATE = Now()
strCAPTION = Upload.Form("CAPTION")
strTEXT = Upload.Form("TEXT")
strPOSTER = Upload.Form("POSTER")
intPOSTER_ID = Upload.Form("POSTER_ID")
intFORUM = Upload.Form("FORUM")
intTHREAD = Upload.Form("THREAD")
intSMILIES = Upload.Form("SMILIES")
intSIGNATURE = Upload.Form("SIGNATURE")
intID = Upload.Form("THREAD")
if Len(strCAPTION) => 1 and Len(strTEXT) => 1 and Len(strPOSTER) => 1 and Len(intPOSTER_ID) => 1 then
if len(uplFILE) > 5 then
end if
Set Conn = Server.CreateObject("ADODB.Connection")
Set RecSet = Server.CreateObject("ADODB.RecordSet")
Conn.Open "PROVIDER=Microsoft.JET.OLEDB.4.0;Data Source="&Server.MapPath("/XXXXXX")
RecSet.Open "SELECT * FROM [F_ANSWERS]", Conn, adOpenStatic, adLockOptimistic, adcmdTableDirect
RecSet.AddNew
RecSet("CAPTION") = strCAPTION
RecSet("TEXT") = strTEXT
RecSet("POSTER") = strPOSTER
RecSet("POSTER_ID") = intPOSTER_ID
RecSet("SMILIES") = intSMILIES
RecSet("SIGNATURE") = intSIGNATURE
RecSet("THREAD") = intTHREAD
RecSet("DATE") = datDATE
RecSet("FILE") = uplFILE
RecSet.Update
RecSet.Close : Set RecSet = Nothing
Conn.Close : Set Conn = Nothing
Response.Redirect("/LWSWE/3FactionAnphillia/start.asp?mItem=60&ID="&intID&"&f="&intFORUM&"")
else
Response.Redirect("/LWSWE/3FactionAnphillia/start.asp?mItem=61&ID="&intID&"&f="&intFORUM&"&msg=INVALID_SUBMISSIONS")
end if
else
Response.Redirect("/LWSWE/3FactionAnphillia/start.asp?mItem=9")
end if
%>
Vad är det som går galet?
Wickmark Medlem sedan juli 2003 162 inlägg Fixat!!!
Trixade lite med koden, och nu funkar det perfekt!
strPath = File.Path '<---Detta är rad 14
if strPath <> "" then
uplFILE = Right(strPath, Len(strPath) - InStrRev(strPath, "\", -1, 1))
else
uplFILE = ""
end if
Skulle visst vara:
if not file is nothing then
strPath = File.Path
if strPath <> "" then
uplFILE = Right(strPath, Len(strPath) - InStrRev(strPath, "\", -1, 1))
else
uplFILE = ""
end if
end if