Jag sitter här o försöker fixa ett upload script men det verkar inte funka speciellt bra om vi säger som så...
Set Upload = Server.CreateObject("Persits.Upload")
Upload.SetMaxSize 100000, True
'spara utan sökväg
Upload.Save
'ta fram katalogsökväg
Path = Server.Mappath(Session("ID") & "/")
'skapa katalogen och ladda upp
Upload.CreateDirectory Path, True
'spara filerna
For Each File in Upload.Files
File.SaveAs Path & File.FileName
Response.Write("File saved as "& File.Path)
Next
Set Upload = Server.CreateObject("Persits.Upload")
Upload.SetMaxSize 100000, True
'spara utan sökväg
Upload.Save
'ta fram katalogsökväg
Path = Server.Mappath(Session("ID"))
'skapa katalogen och ladda upp
Upload.CreateDirectory Path, True
'spara filerna
For Each File in Upload.Files
File.SaveAs Path & "\" & File.FileName
Response.Write("File saved as "& File.Path)
Next
Dim objUpload 'Uplaod component
Dim strNewFileName 'Holds the file name
Dim strThumbFileName 'Holds the thumb file name
'Create upload object
Set objUpload = Server.CreateObject("Persits.Upload.1")
With objUpload
'make sure files aren't over written
.OverwriteFiles = False
'We need to save the file before we can find out anything about it
'** Save virtual is used as saving to memory is often disabled by the web host **
.SaveVirtual Session("ID")
'Get the file name
strNewFileName = .Files(1).ExtractFileName
'Replace spaces with underscores
strNewFileName = Replace(strNewFileName, " ", "_")
'Remove brackets that aspUpload may put in when renaming a file
strNewFileName = Replace(strNewFileName, "(", "", 1, -1, 1)
strNewFileName = Replace(strNewFileName, ")", "", 1, -1, 1)
'Save the file to disk with new file name
'** Copy virtual is used as save as is often disabled by the web host **
.Files(1).CopyVirtual Session("ID") & "\" & strNewFileName
'As a new copy of the file is saved we need to get rid of the old copy
.Files(1).Delete
End With
intWidth = objUpload.Form("width")
intHeight = objUpload("height")
strDatum = objUpload("datum")
strBeskrivning = objUpload("beskrivning")
Set objConnect = Server.CreateObject("ADODB.Connection")
objConnect.Open "DSN=alkisarna"
sql = "insert into bilder (anvID, mappID, fil, width, height, datum, uppladdad, beskrivning) values (" & Session("ID") & ", " & intMapp & ", '" & strNewFileName & "', " & intWidth & ", " & intHeight & ", #" & strDatum & "#, #" & Now() & "#, '" & strBeskrivning & "')"
objConnect.Execute(sql),,128
objConnect.Close : Set objConnect = Nothing
'Response.Redirect("?mid=" & intMapp & """)
'Clean up
Set objUpload = Nothing
funkarom man inte har me nåt om db lr hämtar info från andra textfält... hur ska man egentligen skriva för att spara infon osv?
Får bara sidan kan inte visas... men den hinner iag ladda upp bilden jag drar upp men tar inte emot nåt annat från formuläret...
Kör direkt på mitt webbhotel för har inte komponenten på min burk