Nette\Http\FileUpload::getName PHP Method

getName() public method

Returns the file name.
public getName ( ) : string
return string
    public function getName()
    {
        return $this->name;
    }

Usage Example

Example #1
0
 /**
  * @param FileUpload|NULL $file
  * @param string $folder
  *
  * @return array|bool
  */
 protected function saveImage(FileUpload $file = NULL, $folder = '')
 {
     if ($this->mainManager instanceof MagicManager) {
         $folder = $this->mainManager->getImageFolder();
     } else {
         if ($folder == '') {
             $folder = 'misc';
         }
     }
     // Main image
     $image = NULL;
     if (isset($file) && $file->isOk()) {
         // Save ...
         $year = date('Y');
         $month = date('m');
         $namespace = "{$folder}/{$year}/{$month}";
         $this->imageStorage->setNamespace($namespace);
         $image = $this->imageStorage->save($file->getContents(), $file->getName());
         $filename = pathinfo($image->getFile(), PATHINFO_BASENAME);
         // Prepare thumbnail
         $this->imgPipe->setNamespace($namespace);
         $this->imgPipe->request($filename, '200x200', 'exact');
         $this->imgPipe->setNamespace($namespace);
         $this->imgPipe->request($filename, '100x100', 'exact');
         $data = ['namespace' => $namespace, 'filename' => $filename];
         return $data;
     } else {
         return FALSE;
     }
 }
All Usage Examples Of Nette\Http\FileUpload::getName