Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/10/2007, 08:13
serius29
 
Fecha de Ingreso: octubre-2007
Ubicación: en santiago chile
Mensajes: 34
Antigüedad: 16 años, 5 meses
Puntos: 0
Re: formulario / enviar archivos adjuntos en html

tengo algo en asp, es un formulario que se puede adapatar y tiene la posibilidad de subir archivos, son tres paginas, el formulario, el que recibe y guarda el formulario y uno que se encarga de los archivos que agregas loader.asp

la primera pagina
formulario.asp

<html>
<head>
<title>AGREGAR PRENSA</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="texto.css" rel="stylesheet" type="text/css">
<script language="JavaScript1.2">
<!--
//*****
var primeraVez = true;

function limpia(){
if (primeraVez){
document.form1.txt_Detalle.value = "";
primeraVez = false;
}
}

function cuenta(){
document.form1.total.value = document.form1.txt_Detalle.value.length;
maximo()
}
function maximo(){
var VMaximo
VMaximo = document.form1.txt_Detalle.value.length;
if (VMaximo >50 ){
alert("Sobre paso el maximo de caracteres permitidos")
cadena = document.form1.txt_Detalle.value
//alert(cadena)
cadena = cadena.substring(0,51-1)
document.form1.txt_Detalle.value = cadena
document.form1.txt_principal.focus();
}
}
//****
function validanoticia(){
if (document.form1.txt_titulo.value.length== 0){
alert('El campo titulo no puede estar vacio');
document.form1.txt_titulo.focus();
return (false);
}
if (document.form1.txt_Detalle.value.length== 0){
alert('El campo detalle no puede estar vacio');
document.form1.txt_Detalle.focus();
return (false);
}
if (document.form1.dia.value == 0){
alert('Debe seleccionar una dia');
document.form1.dia.focus();
return (false);
}
if (document.form1.Mes.value == 0){
alert('Debe seleccionar una mes');
document.form1.Mes.focus();
return (false);
}
if (document.form1.Ano.value == 0){
alert('Debe seleccionar una año');
document.form1.Ano.focus();
return (false);
}
if(document.form1.seleccion.value == 0){
alert('debe ingresar un documento');
document.form1.seleccion.focus();
return (false);
}
if (document.form1.publica.checked == false){
if (confirm("Si no selecciona la opción publica solo se grabara la noticia")){
document.form1.publica.click()
return (false);
}
}



}
-->
</script>
</head>
<body background="../../imagenes/fondo_noticias.gif">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="middle">
<td width="33%" height="14" bgcolor="#FBE9A4">
<div align="center" class="titulos"> </div></td>
<td width="33%" bgcolor="#FBE9A4">
<div align="center" class="titulos"> AGREGAR PRENSA </div></td>
<td width="33%" bgcolor="#FBE9A4" class="mensajes" colspan="3">
<div align="center"></div></td>
</tr>
</table>
<BR>
<form name="form1" action="guardar_archivo2.asp" target="mainFrame" enctype="multipart/form-data" method="post" onSubmit="return validanoticia(this)">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="21%" valign="bottom"><div align="right"> <p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Fecha Noticia:</p>
</div></td>
<td width="79%" class="texto">Dia
<select name="dia" class="bored">
<option value="0">Día</option>
<%for Dia = 1 to 31 step 1 %>
<option <%if Dia = Day(now) then%> selected <%end if%> value="<%=Dia%>" <%
'if Ro_Dia = Dia then
' response.write("selected")
'end if%>><%=Dia%></option>
<%next%>
<% Dim Ames(12)
Ames(1) = "Enero"
Ames(2) = "Febrero"
Ames(3) = "Marzo"
Ames(4) = "Abril"
Ames(5) = "Mayo"
Ames(6) = "Junio"
Ames(7) = "Julio"
Ames(8) = "Agosto"
Ames(9) = "Septiembre"
Ames(10) = "Octubre"
Ames(11) = "Noviembre"
Ames(12) = "Diciembre"
%>
</select>
Mes
<select name="Mes" class="bored">
<option value="0">Mes</option>
<%for i= 1 to 12 step 1 %>
<option value="<%=i%>" <%
if i = month(now) then
response.write("selected")
end if%>><%=Ames(i)%></option>
<%next%>
</select>
Año
<select name="Ano" class="bored">
<option selected value="0">Año</option>
<%for i= (year(now())+1) to 2003 step -1 %>
<option value="<%=i%>" <%
if i = year(now()) then
response.write("selected")
end if
%>><%=i%></option>
<%next%>
</select></td>
</tr>
<tr>
<td><div align="right"><p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Titulo:</p>
</div></td>
<td><p style="margin-left: 10; margin-top: 5; margin-bottom: 5">
<input name="txt_titulo" type="text" class="bored" size="50" maxlength="40">
</p>
</td>
</tr>
<tr>
<td valign="top"><div align="right"><p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Detalle:</p>
</div></td>
<td><p style="margin-left: 10; margin-top: 0; margin-bottom: 5"><!-- onFocus="limpia()" onKeyUp="cuenta()" onKeyPress="cuenta()" -->
<textarea name="txt_Detalle" cols="60" rows="8" class="bored"></textarea>
<!--<input type="text" name="total" size="2" maxlength="3" disabled>-->
<!--<font color="#660000" size="1" face="Verdana, Arial, Helvetica, sans-serif">(Max.
de carasteres 39) </font>--></p>
<p></p></td>
</tr>

<!-- <tr>
<td><div align="right"><p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Ubicación:</p>
</div></td>
<td> <p style="margin-left: 10; margin-top: 0; margin-bottom: 5">
<select name="ubicacion">
<option value="0">::Seleccione::</option>
<option value="1">1</option>
<option value="2">2</option>
</select></p></td>
</tr>-->
<tr>
<td><div align="right"><p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Publica:</p>
</div></td>
<td><p style="margin-left: 10; margin-top: 0; margin-bottom: 5">
<input name="publica" type="checkbox" value="Si"></p>
</td>
</tr>
<tr>
<td><div align="right"><p class="texto" style="margin-right: 10; margin-top: 0; margin-bottom: 0">Seleccionar Documento:</p>
</div></td>
<td> <p style="margin-left: 10; margin-top: 0; margin-bottom: 5">
<input type="file" name="seleccion" style="font-family: Verdana; font-size: 8pt" maxlength="200" size="25"></td>
</tr>
<tr>
<td height="23" colspan="2" align="center">
<input name="Grabar" type="submit" id="Grabar" value="Grabar" style="font-family: Verdana; font-size: 8pt">
&nbsp;&nbsp;&nbsp;&nbsp; <input name="Restablecer" type="reset" id="Restablecer" value="Restablecer" style="font-family: Verdana; font-size: 8pt">
</td>
</tr>
</table>
</form>
</body>
</html>