public function putFile(string $sourcefile)
    {
        if (file_exists($sourcefile)) {
            if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
                ($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
            ) {
                $this->grantHash();
                $nb_icontact->grantStorageFolder();
                $base_path = $nb_icontact->getBasePath();
                move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
            } else {
                throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
            }
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
        }
    }
public function putFile(string $sourcefile)
    {
        if (file_exists($sourcefile)) {
            if (($nb_icontact_prospect = $this->getIContactProspect()) instanceof CNabuIContactProspect &&
                ($nb_icontact = $nb_icontact_prospect->getIContact()) instanceof CNabuIContact
            ) {
                $this->grantHash();
                $nb_icontact->grantStorageFolder();
                $base_path = $nb_icontact->getBasePath();
                move_uploaded_file($sourcefile, $base_path . DIRECTORY_SEPARATOR . $this->getFilename());
            } else {
                throw new ENabuIContactException(ENabuIContactException::ERROR_ICONTACT_NOT_FOUND);
            }
        } else {
            throw new ENabuCoreException(ENabuCoreException::ERROR_FILE_NOT_FOUND, array($sourcefile));
        }
    }
public function putFile ( string $ sourcefile ) { if ( file_exists ( $ sourcefile ) ) { if ( ( $ nb_icontact_prospect = $ this -> getIContactProspect ( ) ) instanceof CNabuIContactProspect && ( $ nb_icontact = $ nb_icontact_prospect -> getIContact ( ) ) instanceof CNabuIContact ) { $ this -> grantHash ( ) ; $ nb_icontact -> grantStorageFolder ( ) ; $ base_path = $ nb_icontact -> getBasePath ( ) ; move_uploaded_file ( $ sourcefile , $ base_path . DIRECTORY_SEPARATOR . $ this -> getFilename ( ) ) ; } else { throw new ENabuIContactException ( ENabuIContactException :: ERROR_ICONTACT_NOT_FOUND ) ; } } else { throw new ENabuCoreException ( ENabuCoreException :: ERROR_FILE_NOT_FOUND , array ( $ sourcefile ) ) ; } }
Put the file associated to this attachment in the iContact storage.
@param string $sourcefile Source path of the file to be attached.
@throws ENabuIContactException Raises an exception if source file does not exists or cannot be moved.
Put the file associated to this attachment in the iContact storage .