Jag har skapat en sida för att redigera ett inlägg i en diskussion. På sidan finns även möjlighet att ladda upp / redigera 7 filer och de är namngivna med bild1, bild2, bild3, bild4, bild5, fil01 & fil02.
Jag hämtar filinfo på följande sätt
Server.ScriptTimeout = 300 ' five minutes
' Variables
' *********
Dim mySmartUpload
Dim intCount
' Dim theField
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Deny filetypes
' **************
mySmartUpload.DeniedFilesList = "exe,bat,asp,vbs,com"
' Upload
' ******
mySmartUpload.Upload
' Save the files with their original names in a virtual path of the web server
' ****************************************************************************
intCount = mySmartUpload.Save("/upload/kb")
' skapa variabler för inmatning i db
' **********************************
tmp_fil1 = mySmartUpload.Files(1).Filename
tmp_fil2 = mySmartUpload.Files(2).Filename
tmp_fil3 = mySmartUpload.Files(3).Filename
tmp_fil4 = mySmartUpload.Files(4).Filename
tmp_fil5 = mySmartUpload.Files(5).Filename
tmp_fil6 = mySmartUpload.Files(6).Filename
När jag testar att redigera sidan så finns där 2 filer redan och jag
ändrar bara lite i texten. Jag får då följande felmeddelande
aspSmartUpload.Files error '800404b5'
Invalid Files Name '6' (Error 1205)
/kb/redigera_2.asp, line 30
Tror att detta kan ha att göra med att det bara är 5 file-fält som finns på sidan?!!?
Har testat att namnge fälten i koden, dvs mySmartUpload.Files("fil01").Filename, men det funkar tyvärr inte!
[red]' TimeOut
' *******
Server.ScriptTimeout = 300 ' five minutes
' Variables
' *********
Dim mySmartUpload
Dim intCount
Dim tmp_fil1
Dim tmp_fil2
Dim tmp_fil3
Dim tmp_fil4
Dim tmp_fil5
Dim tmp_fil6
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Deny filetypes
' **************
mySmartUpload.DeniedFilesList = "exe,bat,asp,vbs,com"
' Upload
' ******
mySmartUpload.Upload
' skapa variabler för inmatning i db
' **********************************
tmp_fil1 = mySmartUpload.files.item(1).filename
tmp_fil2 = mySmartUpload.files.item(2).filename
tmp_fil3 = mySmartUpload.files.item(3).filename
tmp_fil4 = mySmartUpload.files.item(4).filename
tmp_fil5 = mySmartUpload.files.item(5).filename
tmp_fil6 = mySmartUpload.files.item(6).filename
' Save the files, [b]if there are any,[/b] with their original names in a virtual path of the web server
' ************************************************************
If Len(tmp_fil1) > 0 Then mySmartUpload.files.item(1).saveas "/upload/kb/"& tmp_fil1
If Len(tmp_fil2) > 0 Then mySmartUpload.files.item(2).saveas "/upload/kb/"& tmp_fil2
If Len(tmp_fil3) > 0 Then mySmartUpload.files.item(3).saveas "/upload/kb/"& tmp_fil3
If Len(tmp_fil4) > 0 Then mySmartUpload.files.item(4).saveas "/upload/kb/"& tmp_fil4
If Len(tmp_fil5) > 0 Then mySmartUpload.files.item(5).saveas "/upload/kb/"& tmp_fil5
If Len(tmp_fil6) > 0 Then mySmartUpload.files.item(6).saveas "/upload/kb/"& tmp_fil6[/red]