Foros del Web » Programando para Internet » PHP »

Que esta mal en mi script

Estas en el tema de Que esta mal en mi script en el foro de PHP en Foros del Web. hice un script para hacer un hosting de imagenes como imageshack la cosa esque cuando subo el script al servidor y lo pruebo, sube la ...
  #1 (permalink)  
Antiguo 13/11/2008, 19:13
Avatar de DarkRing  
Fecha de Ingreso: marzo-2008
Mensajes: 95
Antigüedad: 16 años, 1 mes
Puntos: 1
Que esta mal en mi script

hice un script para hacer un hosting de imagenes como imageshack

la cosa esque cuando subo el script al servidor y lo pruebo, sube la imagen pero si la extencion :S

ejemplo: en ves de "123.jpg" la sube con el nombre de "123."

nose que pueda estar mal porque en localhost me funciona perfectamente

aqui el codigo

Código PHP:
<?php

//cuenta el numero de archivos que hay en el directorio $dir y el resultado se le asigan a la variable $total
$dir "upload/";
$explorar scandir($dir);
$total_archivos count($explorar);
$total 0;

for (
$i 0$i<=$total_archivos$i++) {

    if (
$explorar[$i] != "." && $explorar[$i] != "..") {
    
$total++;
    }
}  




//variobles
$url rand (0,965454552);
$temp $HTTP_POST_FILES['archivo']['tmp_name'];
$subir $HTTP_POST_FILES['archivo']['name'];
$tipos $HTTP_POST_FILES['archivo']['type'];
$extension explode(".",$archivo_name); 
$opcional "/upload/";
$tipo $HTTP_POST_FILES["archivo"]['type'];


if( 
$tipo == "image/jpeg" || $tipo == "image/png" || $tipo == "image/bmp" || $tipo == "image/gif") {

move_uploaded_file($temp"upload/"$total"." $extension[1]);

} else {

header ("Location: http://paginadeerror.com");
}

     
     
     
?>

<title>UP IMG - Hosting de imagenes</title>
</table>
<style type="text/css">.Estilo3 {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 14px;
}
.Estilo4 {font-family: Verdana, Arial, Helvetica, sans-serif}
body {
    background-image: url(fonodasd.jpg);
}
-->
</style>
<table width="208" height="77" style="position:absolute; top: 37px; left: 155px;" border="0" cellspacing="0" background="logo.png">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="208" height="77" style="position:absolute; top: 92px; left: 547px; width: 399px; height: 41px;" border="0" cellspacing="0" background="">
  <tr>
    <td valign="top"><span class="Estilo3">Inicio | Links | Contacto | &iquest; Quienes somos ? </span></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<table width="776" height="371" border="0" align="center" cellspacing="1" bgcolor="#666666">
  <tr>
    <td width="491" valign="top"><table width="776" height="378" border="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
        <td valign="top"><table width="750" height="363" border="0" cellpadding="0" cellspacing="5">
          <tr>
            <td valign="top"><label><br>
              <input type="text" style="width:500" value= "<?php echo "http://"$HTTP_SERVER_VARS['HTTP_HOST'], $opcional $total"."$extension[1]; ?>" >
            </label> 
              Link directo </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><p>&nbsp;</p>
              <p><a href="<?php echo "http://"$HTTP_SERVER_VARS['HTTP_HOST'], $opcional $total"."$extension[1]; ?>"><img height="200" width="200" border="1" src="<?php echo "http://"$HTTP_SERVER_VARS['HTTP_HOST'], $opcional $total"."$extension[1]; ?>"></a></p></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><a href="http://<? $HTTP_SERVER_VARS['HTTP_HOST'?>">Volver a la pagina Inicial</a> </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
  #2 (permalink)  
Antiguo 13/11/2008, 19:34
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 11 meses
Puntos: 2135
Respuesta: Que esta mal en mi script

de donde obtienes la variable $archivo_name?

Saludos.
  #3 (permalink)  
Antiguo 13/11/2008, 19:42
Avatar de DarkRing  
Fecha de Ingreso: marzo-2008
Mensajes: 95
Antigüedad: 16 años, 1 mes
Puntos: 1
Respuesta: Que esta mal en mi script

ya ni recuerdo de donde sale esa variable xD, e sustituido esa variable por la variable $subir y ahora si me va :D

gracias gatorv
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:09.