Ver Mensaje Individual
  #3 (permalink)  
Antiguo 01/09/2006, 11:32
Avatar de seik!
seik!
 
Fecha de Ingreso: mayo-2006
Mensajes: 492
Antigüedad: 18 años
Puntos: 6
la verdad

la verdad no me alega directamente pero al subir un archivo superior a 700 kilos se corta el enlace... asi de simple sin mas y luego se restablece.... mi codigo es el siguiente.

Código:
<form method="POST" enctype="multipart/form-data" name="form" action="oficio_ag.php" ALIGN="top">
	<input type="hidden" name="evento_user" value="<?php print($_SESSION['user_sec'])?>">	
			<table width="510" border="0" cellpadding="0" cellspacing="2">
				<tr><td height="40" colspan="3" class="ti_14_blanco" style="font-size:20;" align="center" bgcolor="#333399">DETALLE NUEVO DOCUMENTO</td></tr>
				

				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#ccffff">&nbsp;Nº de documento</td>

				</tr>

				<tr>
					<td height="25" width="180" class="ti_12_negro" valign="top" bgcolor="#ccffff">&nbsp;Descrip. documento ANT.</td>
					<td width="10" class="ti_12_negro" align="center" valign="top">:</td>
					<td width="320" class="ti_12_negro"><textarea name="ant_oficio" class="text110" style="width:320;" rows="3" onChange="javascript:this.value=this.value.toLowerCase();"></textarea></td>
				</tr>
				<tr><td height="7"></td></tr>
				<tr>
					<td height="25" width="180" class="ti_12_negro" valign="top" bgcolor="#ccffff">&nbsp;Descrip. documento MAT.</td>
								</tr>

				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#ccffff">&nbsp;Fecha del documento</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_9_plomo"><input type="text" name="fecha_oficio" class="text110" maxlength="10" onblur="valFecha(this)"><font color="#C0C0C0">&nbsp;Ej: 31/12/2006</font></td>
				</tr>

				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#ccffff">&nbsp;Fecha de Recepción</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_9_plomo"><input type="text" name="fecha_recepcion_oficio" class="text110" maxlength="10" onblur="valFecha(this)"><font  color="#C0C0C0">&nbsp;Ej: 31/12/2006</font></td>
				</tr>
				<tr><td height="7"></td></tr>
				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#ccffff">&nbsp;Estado documento</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_12_negro">
						<select name="selestado_oficio" disabled>
   							<option value="Ingresado" selected>Ingresado</option> 
   						</select>
					</td>
				</tr>				
				<tr><td height="7"></td></tr>				
				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#CCFFFF">&nbsp;Organismo Regulador</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_12_negro">
						<select name="selorganismo" >
   							<option value="sec">SEC</option> 
   							<option value="cne">CNE</option> 
   							<option value="cdec">CDEC</option> 
						</select>
						<input type="hidden" name="hidorganismo" value="<?php print($row["organismo"]);?>">
						<script language="vbscript">
							document.forms.form.selorganismo.value=document.forms.form.hidorganismo.value
						</script>
					</td>
				</tr>				
				<tr><td height="7"></td></tr>				
				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#CCFFFF">&nbsp;Tipo Documento</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_12_negro">
						<select name="seltipo_oficio">
   							<option value="Oficio Circular">Oficio Circular</option>
							<option value="Resolución Exenta">Resolución Exenta</option>   
   							<option value="Cartas">Cartas</option>
							<option value="Respuesta de Facturación">Respuesta de Facturación</option>
						</select>
						<input type="hidden" name="hidtipo_oficio" value="<?php print($row["tipo_oficio"]);?>">
						<script language="vbscript">
							document.forms.form.seltipo_oficio.value=document.forms.form.hidtipo_oficio.value
						</script>
					</td>
				</tr>
				<tr><td height="7"></td></tr>						
				<tr>
					<td height="25" width="150" class="ti_12_negro" bgcolor="#ccffff">Adjuntar documento&nbsp;</td>
					<td width="10" class="ti_12_negro" align="center">:</td>
					<td width="320" class="ti_12_negro"><input type="file"  name="archivo" size="20" ></td>
				</tr>				
				<tr><td height="25"></td></tr>	
				</table>
				<center>
				<input type="button" name="cmdEnviar" value="Enviar" class="button" onClick="validar(this.form)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="button" name="cmdCancelar" value="Cancelar" onclick="javascript:window.close();">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="reset" value="Borrar" class="button" name="cmdBorrar" >
				</center>
			 </form>	

</center>
</body>
</html>
aqui genero el upload luego de rescatar los datos.

Código:


<?php 
		// Paso 1: Recibimos el formulario: 
		$num_oficio=$_POST["num_oficio"];

		// Obviamente conectamos 
		mysql_connect("200.72.27.187","root"); 
		mysql_select_db("sec"); 

		// Paso 2: Hacemos la consulta a la Tabla por el documento
		$busqueda= mysql_query("SELECT num_oficio FROM oficio WHERE num_oficio='".$num_oficio."'"); 


		// Paso 3: vemos si hubo coincidencias 
		if(mysql_num_rows($busqueda)>0) { // ó " !=0 " como se quiera ver 
       // Inciso a:  
      			echo "<center>
				<table> 
						<tr>
							<td height='100' width='30' class='ti_12_negro' ></td>
						</tr>
						<tr>
							<td height='40' width='330' align='center' class='ti_14_azul' bgcolor='#CCFFFF'>Número de documneto ya existe dentro de los registros, favor ingrese nuevamente</td>
						</tr>
						<tr>
							<td height='30'></td>
						</tr>
						<tr>
							<td height='40' width='330' align='center'><input type='button' class='button' name='cmdsalir' value='Regresar' onclick='javascript:history.back()'></td>
						</tr>
				</table>";       	
				} else {
?>
   
<?php
		// Configuración //
		///////////////////
		// $extensiones=array("1ªext","2ªext","....");
		// Aqui debes poner las extensiones que NO admitas
		// por ejemplo si no quieres admitir .html , .exe ni .gif :
		// $extensiones=array("html","exe","gif");
		///////////////////////////////////////
		$extensiones=array("");
		/////////////////
		// $path="/ruta/ta/ta";
		// Si el server rula bajo LinuX toda la ruta completa /var/etc/..
		// Si rulas bajo WindoWs C:/midirectorioroot/tal..
		// Nota: Sin el último / ej: C:/miweb NO C:/miweb/
		////////////////
		$path="C:/Inetpub\wwwroot\sec2\oficios";
		$nombre=$_FILES['archivo']['name'];
		$tamanio=$_FILES['archivo']['size'];
		$tipo=$_FILES['archivo']['type'];
		$var = explode(".","$nombre");
		$num = count($extensiones);
		$valor = $num-1;
		
			for($i=0; $i<=$valor; $i++) {
    			if($extensiones[$i] == $var[1]) {
    			echo "<center><table> 
					<tr>
						<td height='100' width='30' class='ti_12_negro' ></td>
					</tr>
					<tr>
						<td height='40' width='330' align='center' class='ti_12_negro' bgcolor='#CCFFFF'>Archivo no admitido</td>
					</tr>
					<tr>
						<td height='30'></td>
					</tr>
					<tr>
						<td height='40' width='330' align='center'><input type='button' class='button' name='cmdsalir' value='Salir' onclick='javascript:window.close();'></td>
					</tr>
					</table>";
					$verifica=1;
   				 exit;
    			}
			}
		
		$nombre_archivo = $_POST["num_oficio"].substr($nombre, strlen($nombre) - 4, 4);
		
			if (is_uploaded_file($_FILES['archivo']['tmp_name']))
 				{
  				move_uploaded_file($_FILES['archivo']['tmp_name'], "$path/$nombre_archivo");
  				echo "<center>
					<table> 
						<tr>
							<td height='100' width='30' class='ti_12_negro' ></td>
						</tr>
						<tr>
							<td height='40' width='330' align='center' class='ti_12_negro' bgcolor='#CCFFFF'>Datos ingresados correctamente!
							</td>
						</tr>
						<tr>
							<td height='30'></td>
						</tr>
						<tr>
							<td height='40' width='330' align='center'></td>
						</tr>
					</table>";
 					
				}
			else
 					{ 
 				echo "<center>
					<table> 
						<tr>
							<td height='100' width='30' class='ti_12_negro' ></td>
						</tr>
						<tr>
							<td height='40' width='330' align='center' class='ti_12_negro' bgcolor='#CCFFFF'>Error al subir el archivo</td>
						</tr>
						<tr>
							<td height='20'></td>
						</tr>
						</table>";
						$verifica=1;
					}
?>

******
	<CENTER>
		 <input type="button"  name="cmdaceptar" value="Aceptar" class="button" onclick="javascript:window.close();">
	</CENTER>
 <br> 
<?php if ($verifica==0){ ?>
<?php
				$nom_oficio=$_POST["nom_oficio"];
				$ant_oficio=$_POST["ant_oficio"];
				$mat_oficio=$_POST["mat_oficio"];
				$fecha_oficio=$_POST["fecha_oficio"];
				$fecha_recepcion_oficio=$_POST["fecha_recepcion_oficio"];
				$estado_oficio =$_POST["selestado_oficio"];
				$tipo_oficio=$_POST["seltipo_oficio"];
	            $organismo=$_POST["selorganismo"];
					
				$link = mysql_connect("localhost", "root") or die("Could not connect to database!");
				mysql_select_db("sec") or die("Could not select database!");
				
				$query = "INSERT INTO oficio (nom_oficio, num_oficio, ant_oficio";
				$query.= ", mat_oficio, fecha_oficio, fecha_recepcion_oficio, archivo, estado_oficio, tipo_oficio, organismo) VALUES ";
				$query.= "('".$nom_oficio."',".$num_oficio.",'".$ant_oficio."','".$mat_oficio."'";
				$query.= ", '".$fecha_oficio."','".$fecha_recepcion_oficio."','".$nombre_archivo."','".$estado_oficio."','".$tipo_oficio."','".$organismo."')";
				$result = mysql_query($query, $link);
?>
	
<script languaje="javascript">	
		top.opener.document.location = top.opener.document.location;
</script>
<?php } } ?>
__________________
sEIK! -Chile-
Analista Programador.