public function setFile(UploadedFile $file)
    {
        $this->file = $file;
        $this->name = $file->name;

        if ($this->unique === true && $file->extension) {
            $this->setUriName(uniqid() . '.' . $file->extension);
        } else {
            $this->setUriName($this->name);
        }

        if (file_exists($this->filePath)) {
            $this->setUriName($file->baseName . uniqid() . '.' . $file->extension);
        }

        $this->mime = FileHelper::getMimeTypeByExtension($this->name);
        $this->size = $file->size;

        return $this;
    }
public function setFile(UploadedFile $file)
    {
        $this->file = $file;
        $this->name = $file->name;

        if ($this->unique === true && $file->extension) {
            $this->setUriName(uniqid() . '.' . $file->extension);
        } else {
            $this->setUriName($this->name);
        }

        if (file_exists($this->filePath)) {
            $this->setUriName($file->baseName . uniqid() . '.' . $file->extension);
        }

        $this->mime = FileHelper::getMimeTypeByExtension($this->name);
        $this->size = $file->size;

        return $this;
    }
public function setFile ( UploadedFile $ file ) { $ this -> file = $ file ; $ this -> name = $ file -> name ; if ( $ this -> unique === true && $ file -> extension ) { $ this -> setUriName ( uniqid ( ) . '.' . $ file -> extension ) ; } else { $ this -> setUriName ( $ this -> name ) ; } if ( file_exists ( $ this -> filePath ) ) { $ this -> setUriName ( $ file -> baseName . uniqid ( ) . '.' . $ file -> extension ) ; } $ this -> mime = FileHelper :: getMimeTypeByExtension ( $ this -> name ) ; $ this -> size = $ file -> size ; return $ this ; }
Set model attributes from UploadedFile
@param UploadedFile $file
@return $this
Set model attributes from UploadedFile