Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/05/2008, 11:01
Avatar de manumaf
manumaf
 
Fecha de Ingreso: mayo-2007
Ubicación: Argentina
Mensajes: 854
Antigüedad: 17 años
Puntos: 6
Hosting de imagenes con PHP ayuda simple

Hola tengo el siguiente codigo para colocado en mi web:

Lap agina principal de hosting:
Código PHP:
<form action="manu.php" method="post" enctype="multipart/form-data">
      <input name="imagen" type="file" size="35" />
      <input name="enviar" type="submit" value="Upload Image" />
      <input name="action" type="hidden" value="upload" />
      </form>
      
      <?php if ($varstat == "ok") { ?>
      <strong>Confirmacion:</strong><br>
      Archivo publicado satisfactoriamente.
      Puedes utilizar las siguientes opciones para enlazarlo:<br>
      <strong>Enlace Directo: </strong><br>
      <input name="txt2" type="text" value="<?php echo $varpath?>">
      <img src="tmp/<?php echo $varname?>">
      <?php ?>

      <?php if ($_GET['image'] != "") { ?>
      <img src="tmp/<?php echo $_GET['image']; ?>">
      <?php ?>


Y la accion del formulario:

Código PHP:
<?php
      $varrand 
substr(md5(uniqid(rand())),0,10);       
      
$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");
      
$varpath "http://www.habbotools.com.ar/hostimg?image=";
      
$varstat "";

      if (
is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
          
$varname $_FILES["imagen"]['name'];
          
$vartemp $_FILES['imagen']['tmp_name'];
         
$vartype mime_content_type($vartemp); 
          
          
          {
          if (
in_array($vartype$varallw) && $varname != "") {
              
$arrname explode("."$varname);
              
$varname $varrand.".".$arrname[1];
              if (
copy($vartemp"tmp/".$varname)) {
                  
$varpath $varpath.$varname;
                  
$varstat "ok";
              } else {
                  
$varstat "Error al subir el archivo";
              }
          } else {
              
$varstat "Archivo no valido";
          }
}
?>
Me salta error en la linea 10 que seria:
Código PHP:
$vartype mime_content_type($vartemp); 


Alguien me puede ayudar?