Controller/UploadController.php
protected function processUploadedFiles(FileBag $filebag)
    {
        $adapter = new LocalAdapter($this->get('kernel')->getRootDir().'/../web/media');
        $filesystem = new Filesystem($adapter);

        $processed = array();

        if ($filebag->get('files')) {
            /*
             * @var UploadedFile
             */
            foreach ($filebag->get('files') as $file) {
                // get the unique filepath
                $dest = $this->createUniquePath($file);

                if ($filesystem->write($dest['path'], file_get_contents($file->getPathname()))) {
                    $processed[] = $dest['path'];
                };
            }
        }

        return $processed;
    }
protected function processUploadedFiles(FileBag $filebag)
    {
        $adapter = new LocalAdapter($this->get('kernel')->getRootDir().'/../web/media');
        $filesystem = new Filesystem($adapter);

        $processed = array();

        if ($filebag->get('files')) {
            /*
             * @var UploadedFile
             */
            foreach ($filebag->get('files') as $file) {
                // get the unique filepath
                $dest = $this->createUniquePath($file);

                if ($filesystem->write($dest['path'], file_get_contents($file->getPathname()))) {
                    $processed[] = $dest['path'];
                };
            }
        }

        return $processed;
    }
gets the filebag and moves uploaded files to filesystem.

@param FileBag $filebag

@return array reference list of moved files