Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/04/2013, 14:38
arros
 
Fecha de Ingreso: noviembre-2009
Mensajes: 535
Antigüedad: 14 años, 6 meses
Puntos: 25
devolver nombre al subir archivo zf2

saludo a todos
estaba buscando de como puede devolver el nuevo nombre al subir la imagen

este es me codigo:
Código PHP:
Ver original
  1. $fileInput = new InputFilter\FileInput('image-file');
  2.         $fileInput->setRequired(true);
  3.  
  4.         // You only need to define validators and filters
  5.         // as if only one file was being uploaded. All files
  6.         // will be run through the same validators and filters
  7.         // automatically.
  8.         $fileInput->getValidatorChain()
  9.             ->attachByName('filesize',      array('max' => 20480000))
  10.             ->attachByName('filemimetype',  array('mimeType' => 'image/png,image/x-png,image/jpeg,image/JPG'))
  11.             ->attachByName('fileimagesize', array('maxWidth' => 2000, 'maxHeight' => 1500));
  12.  
  13.         // All files will be renamed, i.e.:
  14.         //   ./data/tmpuploads/avatar_4b3403665fea6.png,
  15.         //   ./data/tmpuploads/avatar_5c45147660fb7.png
  16.         $filter = $fileInput->getFilterChain()->attachByName(
  17.             'filerenameupload',
  18.             array(
  19.                 'target'    => './data/tmpuploads/img.png',
  20.                 'randomize' => true,
  21.             )
  22.         );
  23.         $inputFilter->add($fileInput);
  24.  
  25.         $this->setInputFilter($inputFilter);
__________________
cada vez que aprendes algo te crees que no sabes nada