
09/11/2007, 07:31
|
 | | | Fecha de Ingreso: diciembre-2006
Mensajes: 248
Antigüedad: 18 años, 3 meses Puntos: 0 | |
Re: Aspupload Gracias Daniel00, Esta es la página inicial, que en principio hace lo que debe
<%
dim mNombre
dim mDescripcion
dim mFile
dim mIdTmp
dim mIdi
dim mAnexo
dim mDescFile
mNombre=Request.QueryString("Nombre")
mDescripcion=Request.QueryString("Descripcion")
mFile=Request.QueryString("File")
mIdTmp=Request.QueryString("Temp")
mIdi=Request.QueryString("Original")
mDescFile=Request.QueryString("DescFile")
dim mConn
dim strSql
dim mAdo
set mConn=CreateObject("ADODB.Connection")
mConn.ConnectionString = "miservidor.bd"
mConn.Open
if not len(trim(mNombre))=0 then
if not len(trim(cstr(mIdi)))=0 then
strSql = "select cod_est from t_estatutos where titulo='" & mNombre & "'"
mAdo.Open strSql, mConn
if not mAdo.EOF then
mIdi=mAdo(0)
mAdo.Close
end if
set mAdo = nothing
end if
if len(trim(cstr(mIdTmp)))=0 then 'Nuevo
set mAdo=CreateObject("ADODB.Recordset")
'crea un nuevo id
strSql = "select max(cod_est) from t_estatutos_wrk"
mAdo.Open strsql, mConn
if mAdo.EOF then
mIdTmp=1
else
if isnull(mAdo(0)) then
mIdTmp=1
else
mIdTmp=cint(mAdo(0))+1
end if
mAdo.Close
end if
set mAdo = Nothing
'Inserta el estatuto
strSql = "insert into t_estatutos_wrk (cod_est, titulo, descripcion, fecha) values ("
strsql=strsql & mIdTmp & ", '" & mNombre & "', '" & mDescripcion & "', #" & cstr(Date) & "#)"
mConn.Execute strSql
end if
'Busca el id del anexo
set mAdo=CreateObject("ADODB.Recordset")
strSql = "select max(cod_anexo) from anexo_estatutos_wrk"
mAdo.Open strsql, mConn
if mAdo.EOF then
mAnexo = 1
else
if isnull(mAdo(0)) then
mAnexo = 1
else
mAnexo = cint(mAdo(0))+1
end if
end if
strSql = "insert into anexo_estatutos_wrk (cod_anexo, tipo_anexo, cod_estatuto, anexo, txt_descripcion) values ("
strSql = strSql & mAnexo & ", 1, " & mIdTmp & ", '" & mFile & "', '" & mDescFile & "')"
mConn.Execute strSql
else
if not len(trim(mIdTmp))=0 then
strSql = "delete from anexo_estatutos_wrk where cod_estatuto=" & mIdTmp
mConn.Execute strSql
strSql = "delete from t_estatutos_wrk where cod_est=" & mIdTmp
mConn.Execute strSql
end if
end if
%>
<HTML>
<HEAD>
<TITLE>aspupload</TITLE>
</HEAD>
<BODY>
<FONT FACE="Arial" size="2">
<H4> </H4>
<form name=Pantalla id=Pantalla enctype="multipart/form-data">
<fieldset>
<legend> NUEVOS ESTATUTOS Y OTROS DOCUMENTOS - (Sociedad) </legend>
<label for="nombre"> Nombre del documento </label><br>
<input name="nombre" id="nombre" size="85" maxlength="250" value='<%=mNombre%>'>
<br><br>
<label for="descripcion"> Descripción del documento </label><br> <TEXTAREA id=descripcion name=descripcion rows=5 cols=82><%=mDescripcion%></TEXTAREA>
<br><br>
<table width="100%" border=0>
<tr width="100%">
<td style="width:15%"><font face=Arial size=2><b>Descripción</b></font></td>
<td style="width:35%"><font face=Arial size=2><input type=Text name=descfile id=descfile width="100%"></font></td>
<td style="width:15%"><font face=Arial size=2><b>Archivo</b></font></td>
<td style="width:35%"><font face=Arial size=2><input name="thefile1" type="file" size="55" id=documento></font></td>
</tr>
</table>
<br><br>
<table width="100%" border=0>
<tr>
<th scope=row width="52%">
<label>
<input type=button name=Agregar value="Agregar nuevo documento" onclick='javascript:InsertaImagen();'>
</label>
</th>
<th scope=row width="48%">
<label>
<input type=button name=Cancelar value="Cancelar" onclick='javascript:CancelaImagen();'>
</label>
</th>
</tr>
</table>
<br><br>
<table width="100%" border=0 name=file id=file><tbody>
<tr width="100%" bgcolor='steelblue' align=center>
<td colspan=4 style='width:50%'><font face=Arial size=2 color=White><b>ARCHIVOS</b></font></td>
</tr>
<tr width="100%" bgcolor='steelblue'>
<td style='width:05%'><font face=Arial size=2 color=White><b>Orden</b></font></td>
<td style='width=45%'><font face=Arial size=2 color=White><b>Descripción del aarchivo</b></font></td>
<td style='width=45%'><font face=Arial size=2 color=White><b>Nombre del archivo</b></font></td>
<td style='width=05%'><font face=Arial size=2 color=White><b> </b></font></td>
</tr>
<%=MuestraFilesTemporal%>
</tbody></table>
<br><br><hr>
<table><tbody>
<tr>
<td><input type=button name=ok id=ok value=Aceptar onclick='javascript:LevantaImagenes();'></td>
<td><input type=button name=cancela id=cancela value=Cancelar onclick='javascript:CancelaRegistro();'></td>
</tr>
</tbody></table>
</fieldset>
</form>
</FONT>
</BODY>
</HTML>
<% set mConn = Nothing %>
<% function MuestraFilesTemporal
dim sSQL
dim mTexto
dim mFld
set mFld=CreateObject("ADODB.Recordset")
mTexto = ""
if len(trim(cstr(mIdTmp)))=0 then exit function
sSQL="Select cod_anexo, anexo, txt_descripcion from anexo_estatutos_wrk where cod_estatuto=" & mIdTmp
mFld.Open sSQL, mConn
if not mFld.EOF then
while not mFld.EOF
mTexto = mTexto & "<tr width='100%'>"
mTexto = mTexto & "<td style='width:05%'><font face=Arial size=2>" & mFld(0) & "</font></td>"
mTexto = mTexto & "<td style='width:40%'><font face=Arial size=2>" & mFld(2) & "</font></td>"
mTexto = mTexto & "<td style='width:40%'><font face=Arial size=2>" & mFld(1) & "</font></td>"
mTexto = mTexto & "<td style='width=05%'> </td>"
mTexto = mTexto & "</tr>"
mFld.MoveNext
wend
end if
set mFld = Nothing
MuestraFilesTemporal = mTexto
end function %>
<script language=javascript>
function LevantaImagenes(){
var pIdTmp='<%=mIdTmp%>';
var pOriginal='<%=mIdi%>';
pDir='../../../upload32_new.asp?Temp='+pIdTmp+'&Original='+pOrigi nal;
window.open(pDir);
}
function InsertaImagen(){
var pNombre=document.getElementById("Nombre");
var pDesc=document.getElementById("Descripcion");
var pDocumento=document.getElementById("documento");
var pDescFile=document.getElementById("descfile");
var pId='<%=mIdTmp%>';
var pDir='../../../index_new.asp?Nombre='+pNombre.value+'&Descripcion ='+pDesc.value+'&File='+pDocumento.value+'&Temp='+ pId+'&DescFile='+pDescFile.value;
document.location.href=pDir;
}
function CancelaRegistro(){
var pNombre=document.getElementById("Nombre");
var pDesc=document.getElementById("Descripcion");
var pDocumento=document.getElementById("documento");
var pDescFile=document.getElementById("descfile");
var pId='<%=mIdTmp%>';
var pDir='../../../index_new.asp?Temp='+pId;
pNombre.value="";
pDesc.value="";
pDocumento.value="";
pDescFile.value=""
document.location.href=pDir;
}
function CancelaImagen(){
var pDocumento=document.getElementById("documento");
var pDescFile=document.getElementById("descfile");
pDocumento.value="";
pDescFile.value=""
}
</script> |