Ver Mensaje Individual
  #14 (permalink)  
Antiguo 01/09/2010, 11:26
mcswebsis
 
Fecha de Ingreso: diciembre-2007
Mensajes: 42
Antigüedad: 16 años, 4 meses
Puntos: 0
Respuesta: problemas con serialize

Código PHP:
Ver original
  1. $files = array();
  2.     foreach ($_FILES['my_field'] as $k => $l) {
  3.         foreach ($l as $i => $v) {
  4.             if (!array_key_exists($i, $files))
  5.                 $files[$i] = array();
  6.             $files[$i][$k] = $v;
  7.         }
  8.     }
  9.     // now we can loop through $files, and feed each element to the class
  10.     foreach ($files as $file) {
  11.         // we instanciate the class for each element of $file
  12.         $handle = new Upload($file);
  13.         // then we check if the file has been uploaded properly
  14.         // in its *temporary* location in the server (often, it is /tmp)
  15.         if ($handle->uploaded) {
  16.             // now, we start the upload 'process'. That is, to copy the uploaded file
  17.             // from its temporary location to the wanted location
  18.             // It could be something like $handle->Process('/home/www/my_uploads/');
  19.             $handle->Process($dir_dest);
  20.             // we check if everything went OK
  21.             if ($handle->processed) {
  22.                 // everything was fine !
  23.                 echo '<fieldset>';
  24.                 echo '  <legend>file uploaded with success</legend>';
  25.                 echo '  <p>' . round(filesize($handle->file_dst_pathname)/256)/4 . 'KB</p>';
  26.                 echo '  link to the file just uploaded: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
  27.                 echo '</fieldset>';
  28.             } else {
  29.                 // one error occured
  30.                 echo '<fieldset>';
  31.                 echo '  <legend>file not uploaded to the wanted location</legend>';
  32.                 echo '  Error: ' . $handle->error . '';
  33.                 echo '</fieldset>';
  34.             }
  35.  
  36.         } else {
  37.             // if we're here, the upload file failed for some reasons
  38.             // i.e. the server didn't receive the file
  39.             echo '<fieldset>';
  40.             echo '  <legend>file not uploaded on the server</legend>';
  41.             echo '  Error: ' . $handle->error . '';
  42.             echo '</fieldset>';
  43.         }
  44.     }


esta es la parte donde subo las imagenes y es de donde tomo la variable $files para serializar, entonces lo que debo guardar en la bd es la variable $valor? es correcto?

GRACIAS