Men hvordan ved den for at den skal send billede.jpg hen til i databasen??
<HTML>
<BODY BGCOLOR="white">
<H1>aspSmartUpload : Sample 4</H1>
<HR>
<%
session.Timeout = 50
' set timeout in Minute
loginstatus = session("login")
loginname = session("Brugernavn")
BrugerID = session("BrugerID")
lvl = session("lvl")
' Variables
' *********
Dim mySmartUpload
Dim file
Dim oConn
Dim oRs
Dim intCount
intCount=0
Session.LCID = 1030
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
mySmartUpload.AllowedFilesList = "jpeg,jpg"
mySmartUpload.MaxFileSize = 300000
' ******
' Connect to the DB
' 22:33 22-10-2004
Set oConn = Server.CreateObject("ADODB.Connection")
curDir = Server.MapPath("_private/fdf.mdb")
oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};"
' Open a recordset
' ****************
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Add the current file in a DB field
' **********************************
Select Case File.FileExt
Case "jpeg", "jpg"
filnavn = Session("BrugerID") & ".jpg"
Case "gif"
filnavn = Session("BrugerID") & ".gif"
End Select
file.SaveAs "C:\Inetpub\test\images\bruger\" & filnavn
filnavnet = "
http://localhost/test/images/bruger/" & file.FileName
SQL = "UPDATE Brugere SET bild = '" & filnavnet & "' WHERE BrugerID = '" & Session("BrugerID") & "'"
intCount = intCount + 1
End If
Next
If Err Then 'her indsættes din håndtering af fejl
Response.Write("<b>Wrong selection : </b>" & Err.description)
Else
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")
End If
' Display the number of files uploaded
' ************************************
response.Redirect "profil.asp"
' Destruction
' ***********
oConn.Close
Set oConn = Nothing
%>
</BODY>
</HTML>