Foros del Web » Programando para Internet » ASP Clásico »

mostrar ficheros

Estas en el tema de mostrar ficheros en el foro de ASP Clásico en Foros del Web. hola a todos tengo un problema al mostrar mis ficheros ya que me los muestra varias veces, no sé en que parte del código esté ...
  #1 (permalink)  
Antiguo 20/06/2005, 13:09
 
Fecha de Ingreso: junio-2005
Mensajes: 14
Antigüedad: 19 años, 10 meses
Puntos: 0
mostrar ficheros

hola a todos tengo un problema al mostrar mis ficheros ya que me los muestra varias veces, no sé en que parte del código esté mal. Les agradecería mucho su ayuda.

el código es el siguiente:

<!--#include file="Loader.asp"-->
<%
' -- memos.asp --
' Muestra la lista de los ficheros subidos
Response.Buffer = True
%>
<html>
<head>
<title>CONSULTA DE MEMOR&Aacute;NDUMS</title>
<script type="text/javascript" language="JavaScript">
<!--Begin
var clickedButton = false;
function ChequearTodos(chkbox)
{
for (var i=0;i < document.forms[0].elements.length;i++)
{
var elemento = document.forms[0].elements[i];
if (elemento.type == "checkbox"){
elemento.checked = chkbox.checked
}
}
}
// End-->
</script>
<SCRIPT language=JavaScript>
<!-- hide from JavaScript-challenged browsers
function openWindow(url) {
popupWin = window.open(url,'new_page','width=200,height=200')
}
// done hiding -->
</SCRIPT>
<style>
.uno {
COLOR: #e5e5f1
}
</style>
</head>
<body onLoad="javascript:openWindow('nuevos.html')" vlink="#FFFFFF" alink="#FFFFFF" link="#FFFFFF" style="filter:progid:DXImageTransform.Microsoft.Gr adient(endColorstr='#006600', startColorstr='#CCFF99', gradientType='0');">
<!--Conexión a la base de datos y a la tabla acceso-->
<%
Set Cnn=Server.CreateObject("ADODB.Connection")
Set RS=CreateObject("ADODB.RecordSet")
Cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("Acceso.mdb")
sql=("select id_memo, nombre_memo, memorandum, area from memorandum")
set RS=Cnn.Execute(sql)
%>
<form name="acciones" method="post" action="recibir.asp">
<table bgcolor="006600" width="100%" border="1" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0">
<tr bgcolor="#99CC00">
<td><input type="checkbox" name="id_memo" onClick="ChequearTodos(this);" ></td>
<td width="80"><font color="#FFFFFF"><strong>Número</strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Nombre</strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Para </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>De </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Fecha elaboración </strong></font></td>
<td width="180"><font color="#FFFFFF"><strong>Fecha recepción </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Status</strong></font></td>
</tr>
<% DO UNTIL RS.EOF%>
<tr>
<%
' Se crea el File System Object
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")

' "Uploaded" Folder
Dim folder
Set folder = fso.GetFolder(Server.MapPath("fichero/"))

Dim Files
Set Files = folder.Files
If folder.Size > 0 Then
For Each file In folder.Files
%>
<tr>
<td align="center" height="25" width="1"><input type="checkbox" name="id_evento" value="<%=RS("id_memo")%>"></td>
<td align="justify"><font color="#FFFFFF" size="-1"><strong><%=RS("id_memo")%></strong></font></td>
<td align="justify" >
<%
Response.Write "<a href=""fichero/"
Response.Write file.Name & """>"
Response.Write "<b>" & file.Name
Response.Write "</b></a> "
%>
</td>
<td align="center" height="25" width="1"><font color="#FFFFFF" size="-1"><strong><%=RS("area")%></strong></font></td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.Size & " bytes " & " "
%>
</strong>
</font>
</td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.DateCreated & " "
%>
</strong>
</font>
</td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.DateLastModified & " "
%>
</strong>
</font>
</td>
<td></td>
</tr>
<%
Next
set fso = Nothing
set folder = Nothing
set Files = Nothing
else
Response.Write "No se ha adjuntado ningún archivo"
End If
%>
</tr>
<%
RS.MoveNext
Loop
RS.Close
Set RS=Nothing
Cnn.Close
Set Cnn=Nothing
%>
</table>
<table>
<tr>
<td>
<input type="submit" name="borrar" value="Borrar" title="Borrar" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT: bold 10px verdana; BORDER-LEFT: #666666 1px solid; WIDTH: 60px; CURSOR: hand; BORDER-BOTTOM: #666666 1px solid; HEIGHT: 16px; BACKGROUND-COLOR: #006600; COLOR: white">
</td>
</tr>
</table>
</form>
<form action="portada.html" method="get">
<input type="submit" name="botonNuevo" value="Nuevo" title="Nuevo" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT: bold 10px verdana; BORDER-LEFT: #666666 1px solid; WIDTH: 60px; CURSOR: hand; BORDER-BOTTOM: #666666 1px solid; HEIGHT: 16px; BACKGROUND-COLOR: #006600; COLOR: white">
</form>
</body>
</html>
  #2 (permalink)  
Antiguo 20/06/2005, 13:25
 
Fecha de Ingreso: junio-2005
Mensajes: 14
Antigüedad: 19 años, 10 meses
Puntos: 0
mostrar ficheros

Ya encontré la solución al problema el código es el siguiente por si a alguien le interesa.


<!--#include file="Loader.asp"-->
<%
' -- memos.asp --
' Muestra la lista de los ficheros subidos
Response.Buffer = True
%>
<html>
<head>
<title>CONSULTA DE MEMOR&Aacute;NDUMS</title>
<script type="text/javascript" language="JavaScript">
<!--Begin
var clickedButton = false;
function ChequearTodos(chkbox)
{
for (var i=0;i < document.forms[0].elements.length;i++)
{
var elemento = document.forms[0].elements[i];
if (elemento.type == "checkbox"){
elemento.checked = chkbox.checked
}
}
}
// End-->
</script>
<SCRIPT language=JavaScript>
<!-- hide from JavaScript-challenged browsers
function openWindow(url) {
popupWin = window.open(url,'new_page','width=200,height=200')
}
// done hiding -->
</SCRIPT>
<style>
.uno {
COLOR: #e5e5f1
}
</style>
</head>
<body onLoad="javascript:openWindow('nuevos.html')" vlink="#FFFFFF" alink="#FFFFFF" link="#FFFFFF" style="filter:progid:DXImageTransform.Microsoft.Gr adient(endColorstr='#006600', startColorstr='#CCFF99', gradientType='0');">
<!--Conexión a la base de datos y a la tabla acceso-->
<%
Set Cnn=Server.CreateObject("ADODB.Connection")
Set RS=CreateObject("ADODB.RecordSet")
Cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("Acceso.mdb")
sql=("select id_memo, nombre_memo, memorandum, area from memorandum")
set RS=Cnn.Execute(sql)
%>
<form name="acciones" method="post" action="recibir.asp">
<table bgcolor="006600" width="100%" border="1" bordercolor="#FFFFFF" cellpadding="0" cellspacing="0">
<tr bgcolor="#99CC00">
<td width="80"><font color="#FFFFFF"><strong>Número</strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Nombre</strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Para </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>De </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Fecha elaboración </strong></font></td>
<td width="180"><font color="#FFFFFF"><strong>Fecha recepción </strong></font></td>
<td width="150"><font color="#FFFFFF"><strong>Status</strong></font></td>
</tr>

<tr>
<%
' Se crea el File System Object
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")

' "Uploaded" Folder
Dim folder
Set folder = fso.GetFolder(Server.MapPath("fichero/"))

Dim Files
Set Files = folder.Files
If folder.Size > 0 Then
For Each file In folder.Files
%>
<tr>
<td align="justify"><font color="#FFFFFF" size="-1"><strong><%=RS("id_memo")%></strong></font></td>
<td align="justify" >
<%
Response.Write "<a href=""fichero/"
Response.Write file.Name & """>"
Response.Write "<b>" & file.Name
Response.Write "</b></a> "
%>
</td>
<td align="center" height="25" width="1"><font color="#FFFFFF" size="-1"><strong><%=RS("area")%></strong></font></td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.Size & " bytes " & " "
%>
</strong>
</font>
</td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.DateCreated & " "
%>
</strong>
</font>
</td>
<td>
<font color="#FFFFFF" size="-1">
<strong>
<%
Response.Write " " & file.DateLastModified & " "
%>
</strong>
</font>
</td>
<td></td>
</tr>
<%
RS.MoveNext
Next


set fso = Nothing
set folder = Nothing
set Files = Nothing
else
Response.Write "No se ha adjuntado ningún archivo"
End If
%>
</tr>
<%

RS.Close
Set RS=Nothing
Cnn.Close
Set Cnn=Nothing
%>
</table>
<table>
<tr>
<td>
<input type="submit" name="borrar" value="Borrar" title="Borrar" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT: bold 10px verdana; BORDER-LEFT: #666666 1px solid; WIDTH: 60px; CURSOR: hand; BORDER-BOTTOM: #666666 1px solid; HEIGHT: 16px; BACKGROUND-COLOR: #006600; COLOR: white">
</td>
</tr>
</table>
</form>
<form action="portada.html" method="get">
<input type="submit" name="botonNuevo" value="Nuevo" title="Nuevo" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; FONT: bold 10px verdana; BORDER-LEFT: #666666 1px solid; WIDTH: 60px; CURSOR: hand; BORDER-BOTTOM: #666666 1px solid; HEIGHT: 16px; BACKGROUND-COLOR: #006600; COLOR: white">
</form>
</body>
</html>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:22.