Ver Mensaje Individual
  #5 (permalink)  
Antiguo 14/09/2009, 13:10
Avatar de Distriker
Distriker
 
Fecha de Ingreso: marzo-2008
Ubicación: Las Palmas De Gran Canarias
Mensajes: 924
Antigüedad: 16 años, 1 mes
Puntos: 23
Respuesta: Me ocurre el error "...unexpected '}'..." en host de imagenes

Muchas gracias a los, ya lo solucioné. Lo tendré en cuenta Alvaro, a ver si no se me olvida. Por cierto, me ocurre otro problemas, con el codigo este:

Código php:
Ver original
  1. <form action="" method="post" enctype="multipart/form-data">
  2. <input name="imagen" type="file" size="35" />
  3. <input name="enviar" type="submit" value="Subir Imagen" />
  4. <input name="action" type="hidden" value="upload" />
  5. </form>
  6.  
  7. <?php
  8. $varrand = substr(md5(uniqid(rand())),0,10) ;
  9. $varallw = array("image/bml", "image/gif", "image/jpge", "image/pjpeg", "image/x-png") ;
  10. $varpath = "http://betaconsolas.com/upload/index.php?image=" ;
  11. $varstat = "" ;
  12.  
  13. if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
  14. $varname = $_FILES["imagen"]['name'] ;
  15. $vartemp = $_FILES['imagen']['tmp_name'] ;
  16. $vartype = mime_content_type($vartemp) ;
  17. if (in_array($vartype, $varallw) && $varname != "") {
  18. $arrname = explode(".", $varname) ;
  19. $varname = $varrand.".".$arrname[1] ;
  20. if (copy($vartemp, "tmp/".$varname)) {
  21. $varpath = $varpath.$varname ;
  22. $varstat = "ok" ;
  23. } else {
  24. $varstat = "Error al subir el archivo" ;
  25. }
  26. } else {
  27. $varstat = "Archivo invalido" ;
  28. }
  29. }
  30. ?>
  31.  
  32. <?php if ($varstat == "ok") {  ?>
  33. <h3 style="font-size: 16px">Confirmación:</h1>
  34. <br />
  35. <p>Imagen subida satisfactoriamente.</p>
  36. <p>Ahora podrás utilizar las siguiente opciones para enlazarlo:</p>
  37. <h4 style="font-size: 14px">Enlace directo</h3>
  38. <input name="txt2" type="text" value="<?php echo $varpath ; ?>">
  39. <img src="tmp/<?php echo $varname ; ?>">
  40. <?php } ?>
  41.  
  42. <?php if ($_GET['image'] != "") { ?>
  43. <img src="tmp/<?php echo $_GET['image'] ; ?>" >

Me da este error:

Código php:
Ver original
  1. Fatal error: Call to undefined function mime_content_type() in /home/distriker/domains/betaconsolas.com/public_html/upload-images/index.php on line 42

Me he fijado en el codigo del tutorial y está igual esa linea :S

Código php:
Ver original
  1. $vartype = mime_content_type($vartemp) ;

Saludos
__________________
Si no te quejas, nunca conseguiras nada, pero si te quejas siempre lo perderás todo.
Una mala acción da fruto a un mal Karma.