title: TYPO3 File Reference delete file and reference
body: <p>How to delete the file and the file reference from this model?
  I mean by code in controller. As far as I know there is no method to delete files.</p>
  
  <p>The according TCA:</p>
  
  <pre><code>'backgroundimage' =&gt; array(
      'label' =&gt; 'LLL:EXT:feusersplus/Resources/Private/Language/locallang_db.xlf:tx_feusersplus_domain_model_user.backgroundimage',
      'config' =&gt; \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
          'image', array(
              'appearance' =&gt; array(
                  'createNewRelationLinkTitle' =&gt; 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
              ),
              'maxitems' =&gt; 1,
              'foreign_match_fields' =&gt; array(
                  'fieldname' =&gt; 'backgroundimage',
                  'tablenames' =&gt; 'fe_users',
                  'table_local' =&gt; 'sys_file',
              ),
              'foreign_types' =&gt; array(
                  '0' =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  ),
                  \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  ),
                  \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  ),
                  \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  ),
                  \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  ),
                  \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION =&gt; array(
                      'showitem' =&gt; '
                          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
                          --palette--;;filePalette'
                  )
              )
          ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'])
      ), 
  ),
  </code></pre>
  
  <p>The according Model:</p>
  
  <pre><code>/**
    * backgroundimage
    *
    * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
  */
  protected $backgroundimage = null;
  </code></pre>
  
  <p>I am using TYPO3 7.6.18</p>
  
  <p>Thank you in advance  </p>