Foros del Web » Programando para Internet » Javascript »

Javascript + php

Estas en el tema de Javascript + php en el foro de Javascript en Foros del Web. Hola estoy intentando limitar el ancho en pixeles de las imagenes que se suben en un formulario php. y estoy intentando agregarle un script javascript ...
  #1 (permalink)  
Antiguo 20/07/2010, 21:03
 
Fecha de Ingreso: julio-2009
Mensajes: 311
Antigüedad: 14 años, 9 meses
Puntos: 0
Javascript + php

Hola estoy intentando limitar el ancho en pixeles de las imagenes que se suben en un formulario php.
y estoy intentando agregarle un script javascript pero no se casi nada de este lenguaje y necesito que me ayudes a corregir lo que tengo mal
la idea es que si la imagen tiene mas de 500 pixeles de ancho mueste un alerta para el usuario

<script language=javascript>
function validar(){

if(document.getElementById('archivo1').width >400){
alert('ancho = '+document.getElementById('archivo1').width+'px.') ;
document.form1.archivo1.focus(); }
return false;
}
</script>

form action="procesaAvI1.php" method="post" name="form1" id="form1" enctype="multipart/form-data" onsubmit="return validar(this)">
<table width="521" height="165" border="1" align="center" bgcolor="#336699">
<tr>
<th height="38" colspan="2" bgcolor="#003399" scope="row">
<div align="center" class="Estilo44">Ref.&nbsp;&nbsp;<? echo "<Font Color='red'>". $_GET["idAviso"]." ".$_GET["tpropiedad"] ;?></div></th>
</tr>
<tr>
<th width="263" height="35" bgcolor="#FF0000" scope="row"><div align="left" class="Estilo5">
<div align="center">Seleccione la&nbsp; Imagen Principal </div>
</div></th>
<td width="242" bgcolor="#FF0000"><span class="Estilo5">
<label for="label"></label>
<label for="select"></label>

<label for="label"></label>
<label for="file"></label>
<input type="file" name="archivo1" id="file" />
</span></td>
</tr>
<tr>
<th height="33" bgcolor="#FF0000" scope="row"><div align="left" class="Estilo2">
<div align="center">
<input type="hidden" name="idAviso" value="<? echo $_GET['idAviso']?>" />
<input type="hidden" name="tpropiedad" value="<? echo $_GET['tpropiedad']?>" />
</div>
</div></th>
<td bgcolor="#FF0000"><span class="Estilo5">
<label for="label2"></label>
<label for="label"></label>
<input type="submit" name="Submit" value="Siguiente " id="Submit" />

Etiquetas: php
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 22:26.