<%
strdelete = request.querystring("delete")
strFN = replace(request.querystring("FN"), " ", "%20")
strFT = request.querystring("file")
'display the SHOW-ME-THE-FILE screen
if strdelete = "Show" Then
if strFT = "image" Then
response.write " 
"
response.write "Delete? "
response.write "Lista de Arquivos
"
Else
response.write "" & strFN & "
"
response.write "Delete? "
response.write "Lista de Arquivos
"
End if
response.end
End if
'display the ARE-YOU-SURE screen
if strdelete = "Sure" Then
if strFT = "image" Then
response.write " 
"
response.write "Deseja realmente deletar esta Foto?
"
response.write "Sim, desejo. "
response.write "Não, não delete.
"
Else
response.write "" & strFN & "
"
response.write "Deseja realmente deletar este arquivo ?
"
response.write "Sim, desejo. "
response.write "Não, não delete.
"
End if
response.end
End if
'call the delete function
if strdelete = "Yes" Then
call functionDF()
End if
'the delete function
Sub functionDF()
Dim fso, f1
Set fso = CreateObject("Scripting.FileSystemObject")
Set f1 = fso.GetFile(replace(Server.MapPath(strFN), "%20", " "))
f1.Delete
Response.Write "File " & replace(strFN, "%20", " ") & "
Foto Excluída com Sucesso!!!
"
Response.Write ""
Response.End
End Sub
'view files in this directory - Listar Arquivos!!!
dirtowalk = "./"
'display the files
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(dirtowalk))
Set fc = f.Files
Dim cont, cont_fotos
cont = 0 'contador das linhas da tabela
cont_fotos = 0 'contador do total de fotos
For Each tobdel In fc 'para contar total de fotos
If right(tobdel.name, 4) = ".jpg" Then
cont_fotos = cont_fotos + 1
ElseIf right(tobdel.name, 4) = ".gif" Then
cont_fotos = cont_fotos + 1
End if
Next
%>
| Lista de Fotos |
| Total de Fotos: <%=cont_fotos%> |
<%
For Each tobdel In fc 'para mostrar as fotos
'dont display this page
'If tobdel.name = "default.asp" Then
' response.write ""
'ElseIf tobdel.name = "W3Lib.asp" Then
' response.write ""
'is the file an image?
If right(tobdel.name, 4) = ".jpg" Then
cont = cont + 1
%>
|
|
<%
ElseIf right(tobdel.name, 4) = ".gif" Then
cont = cont + 1
%>
|
<%
'...or another file type
'Else
' response.write "Visualizar "
' response.write "Deletar " & tobdel.name & "
"
End if
If cont > 3 then ' poe o e depois e cria a próxima linha
%>
<% cont = 0
End If
Next
%>
| |
|
| |
| Total de Fotos: <%=cont_fotos%> |
| Voltar |