Hjælp til bruger uploader eget billede
HejJeg kan ikke få mit billede upload til at køre den uploader til min *mdb men den uploader intet billede ?
Her er min asp:
<%
On Error Resume Next
username = Request.Cookies("username")
' Variables
' *********
Dim mySmartUpload
Dim file
Dim oConn
Dim oRs
Dim intCount
Dim ConnectString, conn
Dim ID
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.AllowedFilesList = "jpg,gif"
mySmartUpload.MaxFileSize = 500000
' Upload
' ******
mySmartUpload.Upload
' Connect to the DB
' *****************
Set oConn = Server.CreateObject("ADODB.Connection")
pictures = Server.MapPath("min.mdb")
oConn.Open "DBQ="& pictures &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
' Open a recordset
' ****************
strSQL = "SELECT FILENAME,FILE,username,ID FROM users WHERE username = '" & username & "'"
Set oRs = Server.CreateObject("ADODB.recordset")
Set oRs.ActiveConnection = oConn
oRs.Source = strSQL
oRs.LockType = 3
oRs.Open
' 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
' **********************************
oRs.Update
file.FileToField oRs.Fields("FILE")
oRs("FILENAME") = username & file.FileName
oRs.Update
file.SaveAs("\pictures\" & username & file.filename)
intCount = intCount + 1
End If
Next
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.<BR>")
' Destruction
' ***********
oRs.Close
oConn.Close
Set oRs = Nothing
Set oConn = Nothing
If Err Then
Response.Write("<b>Your Picture is of the wrong kind of type please go back and correct the problem: Only .Jpg and .Gif is allowed !If your think its webmaster´s failure then mail him att: </b><br><a href='java script:self.history.go(-1)'><b><font color='red' font size='2'>Please go back and try again</b></font>" )
else
Response.write ("<b><font size ='2' font color='blue'>Youe have uploaded your picture with success please click below to enter your profile</b></font><br><a href=profile.asp><b><font color='red' font size='2'>Back to profile :-)</b></font>")
end if
'Response.Redirect("profile.asp?updated=true")
%>
<p> </p>
den melder fejl i billede format men viser 1 billede er uploadet
jeg er en nød til det her ;O)
