if mode = "del" then file = server.mappath(path) & "\"& Request.querystring("file") if delFile(file) then Response.write "Slettet" else Response.write "Fil ikke fundet" end if end if
Function ShowFileList(folderspec) Dim fso, f, f1, fc, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(server.mapPath(folderspec)) Set fc = f.Files s = "<table border=""0"" width=""200"">" For Each f1 in fc s = s & "<tr>" s = s & "<td width=""1%"" nowrap align=""right"">"& formatnumber((f1.size/1024000),3) &" MB</td>" s = s & "<td nowrap>"& "<a href="""& folderspec& "/"& f1.name &""">"& f1.name &"</a>" &"</td>" s = s & "<td width=""1%"">"& "<a href="""& scriptname &"?mode=del&file="& server.urlencode(f1.name) &""">Del</a></td>" s = s & "</tr>" Next s = s & "</table>" ShowFileList = s End Function
function delFile(FileSpec) Set fso = CreateObject("Scripting.FileSystemObject") if fso.FileExists(FileSpec) then fso.DeleteFile(FileSpec) delFile = true else delFile = false end if End Function
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.