Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. /**
  2. * file
  3. *
  4. * @var TYPO3CMSExtbaseDomainModelFileReference
  5. */
  6. protected $file = null;
  7. /**
  8. * Returns the file
  9. *
  10. * @return TYPO3CMSExtbaseDomainModelFileReference $file
  11. */
  12. public function getFile()
  13. {
  14. return $this->file;
  15. }
  16.  
  17. /**
  18. * Sets the file
  19. *
  20. * @param TYPO3CMSExtbaseDomainModelFileReference $file
  21. * @return void
  22. */
  23. public function setFile(TYPO3CMSExtbaseDomainModelFileReference $file)
  24. {
  25. $this->file = $file;
  26. }
  27.  
  28. <f:form.upload property="file" />
  29.  
  30. /**
  31. *action initialise
  32. *
  33. *@return void
  34. */
  35. public function initializeAction() {
  36. $this->controllerContext = $this->buildControllerContext();
  37. $arg = $this->request->hasArgument('newFile') ? 'newFile' : 'file';
  38. if (isset($this->arguments[$arg])) {
  39. $uploadConfiguration = array(
  40. UploadedFileReferenceConverter::CONFIGURATION_ALLOWED_FILE_EXTENSIONS => 'jpg,jpeg,html,css,html,png,bmp,txt,doc,docx,xlf,ico,gif,ogg,tiff',
  41. UploadedFileReferenceConverter::CONFIGURATION_UPLOAD_FOLDER => 'uploads/tx_pitsbannermanagement',
  42. );
  43. /** @var PropertyMappingConfiguration $newFileConfiguration */
  44. $newFileConfiguration = $this->arguments[$arg]->getPropertyMappingConfiguration();
  45. $newFileConfiguration->forProperty('file')->setTypeConverterOptions('vendor\Extension\Property\Typeconverter\UploadedFileReferenceConverter',$uploadConfiguration);
  46.  
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement