Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/02/2012, 14:13
esaenz22
(Desactivado)
 
Fecha de Ingreso: abril-2008
Mensajes: 787
Antigüedad: 16 años
Puntos: 7
Pregunta error al subir mutiples archivos

hola. estoy realizando mantenimiento de productos. utilizo la clase upload.class. en la interfaz del formulario esta rellenar los datos del producto y subir multiple imagens. pero al subirlo me da el siguiente error.

al colocar la otra instancia de upload.class (el codigo) para agregar la imagen redimensionada, me genera los siguientes errores:

Warning: getimagesize(C:\Windows\Temp\php4AAF.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\php4AAF.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\php4AAF.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\php4AAF.tmp' to 'imagenes/\bdbeb06ac78a1880775d5448fe2df846.jpg' in D:\AppServ\www\comenzando-desde-cero\repaso 9 (upload class)\ejemplo8 (cms galerias)\includes\class.upload.php on line 3635


es es el codigo que me genera error:

Código PHP:
Ver original
  1. $imagen_thb = new Upload($file);
  2.                            
  3. $imagen_thb->file_new_name_body   = "thb_".$nombre_imagen;
  4. $imagen_thb->image_resize         = true;  
  5. $imagen_thb->image_x              = 40;                    
  6. $imagen_thb->Process('imagenes/');
  7. $nombre_imagen = $imagen_thb->file_dst_name;

este es mi codigo completo.

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

saludos.

Última edición por esaenz22; 08/02/2012 a las 14:20 Razón: correccion del post.