public function prepare(File $file, $entity, $field, $noclobber = true, $forceFilename = '')
    {
        $dir = $this->getDir($entity, $field);
        if ($forceFilename) {
            $pathname = $dir . '/' . $forceFilename;
        } else {
            if ($file instanceof UploadedFile) {
                $fileName = $file->getClientOriginalName();
            } else {
                $fileName = $file->getBasename();
            }

            $i = 0;
            do {
                $f = $this->namingStrategy->normalize($fileName, $i++);
                $pathname = $dir . '/' . $f;
            } while ($noclobber && $this->fs->exists($pathname));
            $this->fs->mkdir(dirname($pathname), 0777 & ~umask(), true);
            $this->fs->touch($pathname);
        }
        $this->preparedPaths[]= $pathname;
        return $pathname;
    }
public function prepare(File $file, $entity, $field, $noclobber = true, $forceFilename = '')
    {
        $dir = $this->getDir($entity, $field);
        if ($forceFilename) {
            $pathname = $dir . '/' . $forceFilename;
        } else {
            if ($file instanceof UploadedFile) {
                $fileName = $file->getClientOriginalName();
            } else {
                $fileName = $file->getBasename();
            }

            $i = 0;
            do {
                $f = $this->namingStrategy->normalize($fileName, $i++);
                $pathname = $dir . '/' . $f;
            } while ($noclobber && $this->fs->exists($pathname));
            $this->fs->mkdir(dirname($pathname), 0777 & ~umask(), true);
            $this->fs->touch($pathname);
        }
        $this->preparedPaths[]= $pathname;
        return $pathname;
    }
public function prepare ( File $ file , $ entity , $ field , $ noclobber = true , $ forceFilename = '' ) { $ dir = $ this -> getDir ( $ entity , $ field ) ; if ( $ forceFilename ) { $ pathname = $ dir . '/' . $ forceFilename ; } else { if ( $ file instanceof UploadedFile ) { $ fileName = $ file -> getClientOriginalName ( ) ; } else { $ fileName = $ file -> getBasename ( ) ; } $ i = 0 ; do { $ f = $ this -> namingStrategy -> normalize ( $ fileName , $ i ++ ) ; $ pathname = $ dir . '/' . $ f ; } while ( $ noclobber && $ this -> fs -> exists ( $ pathname ) ) ; $ this -> fs -> mkdir ( dirname ( $ pathname ) , 0777 & ~ umask ( ) , true ) ; $ this -> fs -> touch ( $ pathname ) ; } $ this -> preparedPaths [ ] = $ pathname ; return $ pathname ; }
Prepares a file for upload, which means that a stub file is created at the point where the file
otherwise would be uploaded.

@param File $file
@param mixed $entity
@param string $field
@param bool $noclobber
@param string $forceFilename
@return string
Prepares a file for upload which means that a stub file is created at the point where the file otherwise would be uploaded .