'Skriver in info som man skickar This error occurs when the asp is directly executed instead of being called from an HTML form with an ENCTYPE="multipart/form-data" tag. Problem med att ladda upp bild!
IF Request.QueryString("Do") = "Add" Then
'Dimmar variabler
Dim Slumptal, SlumptalDatabas, TidenNu, Klockan, Datum, Sposten
TidenNu = Date & Time
Klockan = Time
Datum = Date
Sposten = Time & "-" & Session("Username")
Randomize
Slumptal = Int(Rnd * 1000000000000)
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.MaxFileSize = 400000
mySmartUpload.Upload
mySmartUpload.AllowedFilesList = "jpg,gif,png"
' DeniedFilesList can also be used :
' Allow all files except exe, bat and asp
' ***************************************
' mySmartUpload.DeniedFilesList = "exe,bat,asp"
' Deny physical path
' *******************
mySmartUpload.DenyPhysicalPath = True
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' ************************************************************
****************
file.SaveAs("Upload/" & Session("Username") & "/Forum/" & Slumptal & "." & file.FileExt)
SlumptalDatabas = Slumptal & "." & file.FileExt
' sample with a physical path
' file.SaveAs("c:\temp\" & file.FileName)
' Uppdaterar Sqln till databasen
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open " driver=MySQL;server=localhost;uid=uid;pwd=lösenord;database=
Forum"
SQL = "INSERT INTO svar (Fran, PersonalStatus, Tid, Bild, Rubrik, Meddelande, SvarsID, Bifogat) Values ('" & Session("Username") & "','" & Session("Status") & "','" & Klockan & "','" & Session("Image") & "','" & mySmartUpload.Form("headline") & "','" & mySmartUpload.Form("Meddelande") & "','" & mySmartUpload.Form("SvarsID") & "','" & SlumptalDatabas & "')"
Connect.Execute(SQL)
Connect.Close
Set Connect = Nothing
ELSE
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open " driver=MySQL;server=localhost;uid=uid;pwd=lösenord;database=
Forum"
SQL = "INSERT INTO svar (Fran, PersonalStatus, Tid, Bild, Rubrik, Meddelande, SvarsID) Values ('" & Session("Username") & "','" & Session("Status") & "','" & Klockan & "','" & Session("Image") & "','" & mySmartUpload.Form("headline") & "','" & mySmartUpload.Form("Meddelande") & "','" & mySmartUpload.Form("SvarsID") & "')"
Connect.Execute(SQL)
Connect.Close
Set Connect = Nothing
End If
Next
'------DETTA SKA ALLTID VARA MED!
'Uppdaterar info till rubriken
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open " driver=MySQL;server=localhost;uid=uid;pwd=lösenord;database=
Forum"
SQL = "UPDATE rubrik Set Sposten = '" & Sposten & "',DatumTid = '" & TidenNu & "',SettAlla = 'Nej',Svar = Svar + 1 Where ID = '" & Request.Form("SvarsID") & "'"
Connect.Execute(SQL)
Connect.Close
Set Connect = nothing
Response.Redirect "ForumMessage.asp?Org=" & Request.Form("OrgForum") & "&Open=" & Request.Form("SvarsID")
End IF
Jag bör väll också tilläga att jag får felet:
Feltyp:
aspSmartUpload (0x800A0009)
Subscript out of range
/version2/ForumMessage.asp, line 25
.. Och att line 25 är: mySmartUpload.UploadSv: Problem med att ladda upp bild!
Detta är vad det står i aspUpload.coms FAQ. Jag vet inte om du har läst det, eller kanske du redan har löst problemet.
Annars är lösningen att i formuläret som du laddar upp filerna med måste det stå i form-taggen ENCTYPE="multipart/form-data". Annars funkar det inte.