Har inte lyckats med att spara filen till disk och även in i databasen, nån som kan hjälpa???????
'Option Explicit
Dim objUpload
Dim strName
dim objFile
Dim objFile2
Dim varyErrors
Dim iErr
Dim blnErr
blnErr = False
Set objUpload = New overrUpload
strName = objUpload("txtName")
'Response.Write("Textfield txtName = " & strName)
'## -- get the first file for upload --
Set objFile = objUpload.Form("theFile")
'## -- check if we have a file --
If objFile.IsFile Then
'## -- file exists. proceed saving file. --
Call objFile.SaveToFile(Server.MapPath("/images/gallery/" & objFile.Filename), True)
'## -- check if any errors occured --
If objFile.HasErrors Then
blnErr = True
'## -- HUSTON! we got errors. proceed --
'## -- get all error messages --
varyErrors = objFile.GetErrors()
'## -- loop through all errors --
For iErr = 0 TO UBound(varyErrors)
'## -- print out error --
Response.Write(varyErrors(iErr) & "<hr>")
Next
End If
End If
Set objFile = Nothing
'## -- get second file for upload --
Set objFile2 = objUpload.Form("anotherFile")
'## -- check if we have a file --
If objFile2.IsFile Then
'## -- file exists. proceed saving file. --
Call objFile2.SaveToFile(Server.MapPath("/images/gallery/" & objFile2.Filename), True)
'## -- check if any errors occured --
If objFile2.HasErrors Then
blnErr = True
'## -- HUSTON! we got errors. proceed --
'## -- get all error messages --
varyErrors = objFile2.GetErrors()
'## -- loop through all errors --
For iErr = 0 TO UBound(varyErrors)
'## -- print out error --
Response.Write(varyErrors(iErr) & "<hr>")
Next
End If
End If
Set objFile2 = Nothing
Set objUpload = Nothing
%>
<%
Dim objConn
varTillhor= Session ("userID")
varInlagd = Now()
varNamn=strName
SET objConn = connect()
picture = "INSERT INTO tblUsers_Galleri"
picture = picture & "(bild,tillhor,inlagd,alt) "
picture = picture & "VALUES(objFile.Filename,"& varTillhor &",#"& varInlagd&"#,"& varNamn &")"
'objConn.Execute picture
response.write picture
%>
<!--#include virtual="/pictureupload/upload1.asp"-->
<%'## -- check if we have any errors. If no errors redirect user to default page --
If blnErr = False Then Response.Redirect("/pictureupload/default1.asp")
Jag skulle tippa, fast jag har haft en ganska hög felprocent på sista tiden ;) , att du får fel pga du har stängt ditt objekt, objFile, fast du försöker sen använda det.
Om du inte ens har lyckats spara filen till disk, får du felmess?
Finns mappen /images/gallery/?
Du ser ut att utgå från roten där.
Jag skulle tippa, fast jag har haft en ganska hög felprocent på sista tiden ;) , att du får fel pga du har stängt ditt objekt, objFile, fast du försöker sen använda det.
Om du inte ens har lyckats spara filen till disk, får du felmess?
Finns mappen /images/gallery/?
Du ser ut att utgå från roten där.
Mappen finns och först fick jag felmess, object required....men nu bara kommer jag tillbaka till uppladdningssidan utan att nåt har sparats eller laddats upp
txtname, har du ett fält som heter så i din form? Eller försöker du använda dig av det?
Koden på oh runt rad nr 145?
ett fält som heter txtName måste finnas enligt skaparen av scriptet för att slippa nåt fel
Kodrad 135-155
Dim UploadControl '## -- replace with array --
Dim pos ' As Integer
Dim Name '## -- remove. save to array --
Dim posFile ' As Integer
Dim posBound ' As Integer
Dim Value '## -- remove. save to array --
Dim Filename '## -- remove. save to array --
Dim ContentType '## -- remove. save to array --
ByteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
'# Begin boundary
PosBeg = 1
'PosEnd = InstrB(PosBeg, RequestBin, getByteString(chr(13)))
PosEnd = InstrB(PosBeg, RequestBin, GetBytesFromString(chr(13)))
boundary = MidB(RequestBin, PosBeg, PosEnd - PosBeg)
boundaryPos = InstrB(1, RequestBin, boundary)
'Get all data inside the boundaries
Do until (boundaryPos = InstrB(RequestBin, boundary & GetBytesFromString("--")))
'Members variable of objects are put in a dictionary object