Ik heb een script gemaakt waarbij men via html formulier een file upload naar een directory, deze file word vervolgens als attachment naar mijn mail gestuurd, hierna wil ik een stuk script dat de file delete op de server. Ik heb het volgende maar dit pikt hij niet.
Ziet iemand wat ik verkeerd doe?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| ' Create the file, change the path to the path U use for temp storage of the file
' make sure you have the IUSR_YOURCOMPUTER granted WRITE access to the uploads dir
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(server.mappath("../cgi-bin") & "\" & FileName, ForWriting, True)
f.Write strFileData
' Get full Path, you need it for deleting the file later
Dim ThisFile
ThisFile = server.MapPath("../cgi-bin") & "/" & filename
lngNumberUploaded = lngNumberUploaded + 1
' destroy f, free memory
set f = nothing
'Get then next boundry postitions if any
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1
loop
if mailComp = "mail" then
set cdoMessage = Server.CreateObject("CDO.Message")
set cdoConfig = Server.CreateObject("CDO.Configuration")
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
cdoConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpServer
cdoConfig.Fields.Update
set cdoMessage.Configuration = cdoConfig
cdoMessage.From = "test@test.nl"
cdoMessage.ReplyTo = replyTo
cdoMessage.To = "test@test.nl"
cdoMessage.Subject = subject
cdoMessage.HtmlBody = body
cdoMessage.AddAttachment ThisFile
on error resume next
cdoMessage.Send
fs.DeleteFile = ThisFile
if Err.Number <> 0 then
SendMail = "Email send failed: " & Err.Description & "."
end if
set cdoMessage = Nothing
set cdoConfig = Nothing |
Ziet iemand wat ik verkeerd doe?