> Kan da prøve....
Det sætter jeg *stor* pris på.
Det er nemlig kun én fil der skal/kan uploades så jeg har gjort følgende uden
held :
snip
<%
On Error Resume Next
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Only allow txt or htm files
' ***************************
mySmartUpload.AllowedFilesList = "jpg,gif"
' DeniedFilesList can also be used :
' Allow all files except exe, bat and asp
' ***************************************
' mySmartUpload.DeniedFilesList = "exe,bat,asp, htm, html, php, css"
' Deny physical path
' *******************
mySmartUpload.DenyPhysicalPath = True
' Only allow files smaller than 30000 bytes
' *****************************************
mySmartUpload.MaxFileSize = 30000
' Deny upload if the total fila size is greater than 200000 bytes
' ***************************************************************
mySmartUpload.TotalMaxFileSize = 200000
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
intCount = mySmartUpload.Save("../Upload")
' sample with a physical path
' intCount = mySmartUpload.Save("c:\temp\")
' Trap errors
' ***********
If Err Then
Response.Write("<b>Wrong selection : </b>" & Err.description)
Else
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")
End If
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("Database.mdb")
Conn.Open DSN
login = Replace(Request.Form("Login") & "", "'", "''")
billede = Server.Mappath("din virtuelle sti") & File.FileName
sqlCheck = "SELECT COUNT(*) as antal FROM admin " & _
"WHERE Login = '" & Request.Form("Login") & "'"
set rs = conn.execute(sqlCheck)
If not rs.EOF Then
boolOK = rs(0) > 0
Else
boolOK = false
End If
If boolOK = 0 Then
Login = Trim(Replace(Request.Form("Login"),"'","''" ))
Password = Trim(Replace(Request.Form("Password"),"'","''" ))
Email = Trim(Replace(Request.Form("Email"),"'","''" ))
Town = Trim(Replace(Request.Form("Town"),"'","''" ))
Website = Trim(Replace(Request.Form("Website"),"'","''" ))
strSQL = "Insert into admin("
strSQL = strSQL & "Login, "
strSQL = strSQL & "Email, "
strSQL = strSQL & "Town, "
strSQL = strSQL & "Website, "
strSQL = strSQL & "Pic, "
strSQL = strSQL & "Password) "
strSQL = strSQL & "values( "
strSQL = strSQL & "'" & mySmartUpload.Form("Login") & "', "
strSQL = strSQL & "'" & mySmartUpload.Form("Email") & "', "
strSQL = strSQL & "'" & mySmartUpload.Form("Town") & "', "
strSQL = strSQL & "'" & mySmartUpload.Form("Website") & "', "
strSQL = strSQL & "'" & billede & "', "
strSQL = strSQL & "'" & mySmartUpload.Form("Password") & "') "
Response.write strSQL
Response.end
Conn.Execute(strSQL)
%>
Billedet bliver rigtigt nok uploaded til korrekte mappe, men stien bliver ikke
sendt. Når jeg udskriver SQL:
Insert into admin(Login, Email, Town, Website, Pic, Password) values( 'Jacob',
'mail@mail.dk', 'Kbh', '
www.www.dk', '', 'xxxsss')
Det er meeeeeeeeeget mystsik (især når man er asp-novice)...
Hjæææææælp!
(Jeg ved at der et par overflødige linier, men - dem fjerner jeg når resten
virker
... )
--
Vil du lære at kode HTML, XHTML, CSS, SSI eller ASP?
- Pædagogiske tutorials på dansk
- Kom godt i gang med koderne
KLIK HER! =>
http://www.html.dk/tutorials