Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/01/2009, 12:31
puppo
 
Fecha de Ingreso: noviembre-2003
Ubicación: viña
Mensajes: 4
Antigüedad: 20 años, 5 meses
Puntos: 0
Problema con upload de archivo en php

Estimados muy buenas tardes, soy nuevo en esto y descarge un pequeño php para subir archivos, mi problema es que cuando deseo subir las imagenes al directorio correspondiente esta solo que da en la raiz debido a que la variable que contiene el codigo del directorio esta vacia.

favor si me pueden ayudar donde este el problema les estaria muy agradecido, les pongo el codigo que tengo para ver si me pueden ayudar:

<?
include ("seguridad.php");
include("conex.php");
$link=Conectarse();
$codigo=$_GET['id']; CAPTURO EL CODIGO
$destino ="../../Buscador/propiedades/".$codigo;
echo $destino; MUESTRA COMPLETO DIRECTORIO INCLUYENDO EL CODIGO
$imagen="/".$HTTP_POST_FILES['archivo']['name'];
?>
<?

if($boton) {
echo $codigo; AQUI YA NO SE MUESTRA EL CODIGO
if (is_uploaded_file($HTTP_POST_FILES['archivo']['tmp_name'])) {
if($HTTP_POST_FILES['archivo']['size'] < 100000) {
if($HTTP_POST_FILES['archivo']['type']=="image/jpg" || $HTTP_POST_FILES['archivo']['type']=="image/pjpeg") {
copy($HTTP_POST_FILES['archivo']['tmp_name'], $destino.$imagen);
$subio = true;
}
}
}

if($subio) {

echo "El archivo subio con exito";
echo $destino; LO MUESTRA
echo $codigo; NO LO MUESTRA
echo $imagen; MUESTRA EL NOMBRE DEL ARCHIVO

} else {
echo "El archivo no cumple con las reglas establecidas";
}
die();
}

?>


<!--$HTTP_POST_FILES['archivo']['name']
!-->
<html>
<head>
<title>Upload en PHP - Ejemplo 2</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="estilo.css" rel="stylesheet" type="text/css">
</head>

<body>
<form action="<?=$PHP_SELF?>" method="post" enctype="multipart/form-data" name="form1">

<table width="100%" border="00" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2" align="center" bgcolor="#EBEBEB" class="style5">SUBIR IMAGEN PARA PROPIEDAD CODIGO: <span class="style7">
<?php echo $codigo ;?> MUESTRA EL CODIGO
</span></td>
</tr>
<tr>
<td colspan="2" align="center" class="style5">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center">
<? if ($foto=="../../images/default.jpg")
{
$foto="images/default.jpg";
?><img src="<?=$foto?>" width="140" border="1" /><?
}?>
<br />
<span class="style8">Imagen Actual</span></td>
</tr>
<tr>
<td class="style8">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#EBEBEB"><span class="style8">Subir imagen: </span></td>
<td bgcolor="#EBEBEB" id="files">
<input name="archivo" type="file" id="archivo" class="style8"/>

</td>
<tr>
<td bgcolor="#EBEBEB">&nbsp;</td>
<td bgcolor="#EBEBEB">&nbsp;</td>
</tr>
<tr>
<td bgcolor="#EBEBEB">&nbsp;</td>

<td bgcolor="#EBEBEB"><input name="boton" type="submit" id="boton" value="Enviar" class="style8"/></td>
</tr>

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form>

<table width="100%" border="00" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#A9B032"><input name="Submit2" type="button" class="style8" value="Cerrar Ventana" onclick="javascript:window.close();"/></td>
</tr>
</table>
</body>
</html>