Hej, jeg har lidt på fornemmelsen at en af jer bedre kan fortælle
mig hvad jeg skal gøre hvis jeg viser jer koden til den side som
melder fejl. den hedder insert.asp der er 4 andre sider som
hedder: debu.asp, loader.asp, show.asp, showFSO.asp, upload.mdb
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
' load object
Dim load
Set load = new Loader
' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
pathToFile = Server.mapPath("/1.b/img/uploadtohere/") & "\" &
fileName
' Uploading file data
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
' destroying load object
Set load = Nothing
%>
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt;
}
</style>
</head>
<body>
<p align="center">
File Uploading with ASP<br>
<a href="show.asp">To see uploaded files click here</a>
</p>
<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated
%></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>
<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be
uploaded...</font>"
Response.Write "<br>Please select a file before hitting the
'Submit' button."
End If
%>
</p>
<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data"
action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput
%>"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit">
<input type="hidden" name="fileName" value="<%= fileName %>">
<input type="hidden" name="filePath" value="<%= filePath %>">
<input type="hidden" name="filePathComplete" value="<%=
filePathComplete %>">
<input type="hidden" name="fileSize" value="<%= fileSize %>">
<input type="hidden" name="fileSizeTranslated" value="<%=
fileSizeTranslated %>">
<input type="hidden" name="contentType" value="<%=
contentType %>">
<input type="hidden" name="countElements" value="<%=
countElements %>">
<input type="hidden" name="nameInput" value="<%= nameInput
%>">
</td></tr>
</form>
</tr>
</table>
<%
DIM Conn,strConn,SQLstmt,RS,imgpath
imgpath="
http://bise.homepage.dk/1.b/img/uploadtohere/"
set Conn = server.createobject("adodb.connection")
strConn = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("/database/upload.mdb")
Conn.open strConn
SQLstmt = "INSERT INTO files
(fileName,filePath,filePathComplete,fileSize,fileSizeTranslated,c
ontentType,countElements,nameInput,imgpath)"
SQLstmt = SQLstmt & " VALUES ("
SQLstmt = SQLstmt & "'" & fileName & "',"
SQLstmt = SQLstmt & "'" & filePath & "',"
SQLstmt = SQLstmt & "'" & filePathComplete & "',"
SQLstmt = SQLstmt & "'" & fileSize & "',"
SQLstmt = SQLstmt & "'" & fileSizeTranslated & "',"
SQLstmt = SQLstmt & "'" & contentType & "',"
SQLstmt = SQLstmt & "'" & countElements & "',"
SQLstmt = SQLstmt & "'" & nameInput & "',"
SQLstmt = SQLstmt & "'" & imgpath & "'"
SQLstmt = SQLstmt & ")"
Set RS = conn.execute(SQLstmt)
If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.count> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number
& "<P>"
response.write "Error desc. -> " &
conn.errors(counter).description & "<P>"
next
else
Response.Write "<font color=""red"">Thanks...Database
Up-dated.</font>"
end if
%>
</body>
</html>
--
Vil du lære at kode HTML, XHTML, CSS, SSI, ASP eller ASP.NET?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials