aspSmartUpload.SaveAs
jeg har en code der uploader til en mappe og lægger filenavn ind i en date base, nu vil jeg så høre om det kan lade sig gøre at after at filenavn er lagt ind en en data base at den så renamer filen til dato?jeg har prøvet med:
mysmartUpload.files.item(1).saveas ""&now&".pgn"
men kan ikke få det til at virke
code:
<%
On Error Resume Next
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
mySmartUpload.AllowedFilesList = "pgn"
mySmartUpload.DenyPhysicalPath = True
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
intCount = mySmartUpload.Save("/aspSmartUpload")
' sample with a physical path
' intCount = mySmartUpload.Save("c:\temp\")
' Display the number of files uploaded
' ************************************
If Err Then
Response.Write("<b>Wrong selection : </b>" & Err.description)
%> <META HTTP-EQUIV="Refresh" CONTENT="10;URL=3.asp">
Du bliver sent afsted om 10 sek.<%
Else
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.")
'Tjek der er valgt en fil:
If mySmartUpload.Files.Item(1).IsMissing = false Then
filnavn = mySmartUpload.Files.Item(1).FileName
'Gem filnavnet i databasen
Set Conn = Server.CreateObject("ADODB.Connection")
'DENNE LINJE SKAL DU TILPASSE TIL DIN DATABASE
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& server.mappath("upload.mdb")
'Lav SQL som indsætter filnavnet i databasen ret tabel og kolonnenavne
SQL = "INSERT INTO upload (file, person, dato) VALUES ('" & filnavn & "','" & session("ui56") & "','"&now&"')"
'Udfør SQLen
Conn.Execute (SQL)
Conn.Close
Set Conn = Nothing
%> <META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://skp-1085-2">
Du bliver sent afsted om 10 sek.<%
End If
End If
%>
