Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/02/2012, 11:36
esaenz22
(Desactivado)
 
Fecha de Ingreso: abril-2008
Mensajes: 787
Antigüedad: 16 años
Puntos: 7
Pregunta error al subir multiples imagenes

hola. desarrolle un mantenimiento de galeria de productos. al ingresar los productos, subo tambien las fotos a redimensionar. el proceso es que al subir las fotos haga 2 redimensiones. una para el producto principal y las demás fotos para las galerías. al realizar el proceso me muestra el siguiente error:

Warning: getimagesize(C:\Windows\Temp\php7FC8.tmp) [function.getimagesize]: failed to open stream: No such file or directory in D:\AppServ\www\comenzando-desde-cero\repaso 9 (upload class)\ejemplo8 (cms galerias)\includes\class.upload.php on line 2877

Warning: fopen(C:\Windows\Temp\php7FC8.tmp) [function.fopen]: failed to open stream: No such file or directory in D:\AppServ\www\comenzando-desde-cero\repaso 9 (upload class)\ejemplo8 (cms galerias)\includes\class.upload.php on line 2936

Warning: move_uploaded_file(C:\Windows\Temp\php7FC8.tmp) [function.move-uploaded-file]: failed to open stream: No such file or directory in D:\AppServ\www\comenzando-desde-cero\repaso 9 (upload class)\ejemplo8 (cms galerias)\includes\class.upload.php on line 3635

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php7FC8.tmp' to 'productos/thumbnail/\22ada5ec9f4d73ea1e4d313f9c774284.jpg' in D:\AppServ\www\comenzando-desde-cero\repaso 9 (upload class)\ejemplo8 (cms galerias)\includes\class.upload.php on line 3635


aqui dejo mi codigo.

Código PHP:
Ver original
  1. if(isset($_FILES))
  2. {
  3.     $idproducto = mysql_insert_id();
  4.    
  5.     foreach($_FILES as $files => $file)
  6.     {
  7.         if(isset($file['name']) && !$file['error'] && $file['size']!=0)
  8.         {
  9.            
  10.             $f=1;
  11.             while($f)
  12.             {
  13.                 $nombre = 'productos/'.$f.$file['name'];
  14.                 $nombre_imagen = $f.$file['name'];
  15.                 clearstatcache();
  16.                
  17.                 if (file_exists($nombre))
  18.                     $f++;
  19.                 else
  20.                     $f=0;
  21.             }
  22.                
  23.                 // we instanciate the class for each element of $file
  24.                 $handle = new Upload($file);
  25.                
  26.                 // then we check if the file has been uploaded properly
  27.                 // in its *temporary* location in the server (often, it is /tmp)
  28.                 if ($handle->uploaded)
  29.                 {
  30.                     $handle->image_resize            = true;
  31.                     $handle->image_ratio_y           = true;
  32.                     $handle->image_x                 = 252;
  33.                     $handle->Process('productos/thumbnail/');
  34.                    
  35.                     // creo una variable $nombre_imagen para enviar los nombres de las imagenes.
  36.                     $nombre_imagen = $handle->file_dst_name;
  37.                     $handle->clean();                          
  38.                 }
  39.                 else
  40.                 {
  41.                     // if we're here, the upload file failed for some reasons
  42.                     // i.e. the server didn't receive the file
  43.                     echo '  file not uploaded on the server';
  44.                     echo '  Error: ' . $handle->error . '';
  45.                 }
  46.                
  47.                 // (imagen thb para las galerias)
  48.                 // we instanciate the class for each element of $file
  49.                 $imagen_thb = new Upload($file);
  50.        
  51.                 // then we check if the file has been uploaded properly
  52.                 // in its *temporary* location in the server (often, it is /tmp)
  53.                 if ($imagen_thb->uploaded)
  54.                 {
  55.                     $imagen_thb->image_resize         = true;
  56.                     $imagen_thb->image_ratio_fill     = true;      
  57.                     $imagen_thb->image_x              = 74;
  58.                     $imagen_thb->image_y              = 74;            
  59.                     $imagen_thb->Process('productos/thumbnail/');                      
  60.                     $foto_imagen_thb = $imagen_thb->file_dst_name;
  61.                    
  62.                 }
  63.                
  64.                 // pregunto si la variable a ingresar esta o no vacia.
  65.                 if($nombre_imagen!="" && $foto_imagen_thb!="")
  66.                 {
  67.                     // hacemos el insert para la tabla puente que en este caso es galeria_producto
  68.                     $sql_galeria_fotos  = "INSERT INTO galeria_producto(idproducto,imagen,imagen_thb)VALUES('$idproducto','$nombre_imagen','$foto_imagen_thb')";
  69.                     echo $sql_galeria_fotos;
  70.                     echo "<br />";
  71.                     query($sql_galeria_fotos,$cn) or die(mysql_error());               
  72.            
  73.                    
  74.                 }
  75.                                            
  76.                
  77.  
  78.         }
  79.        
  80.     } // termina el bucle foreach.
  81.    
  82.    
  83. }

saludos.