[Flow] Filetype Validator

Jan Greth jan at greth.me
Wed Jan 22 09:07:31 CET 2014


>
> I don't have one, but what filetypes are you looking for? With TYPO3.Media,
> there is a ImageValidator as an example
>

Yes that's exactly what I'm looking for. I want to upload Images with 
the TYPO3.Media Package. But till now I could not validate, that the 
uploaded file is really an image.

For example when i upload a pdf i get an error "An error occurred while 
trying to call JPG\Media\Controller\ItemController->createAction()".
Is that the (relly cryptic) error of the validator?

the create Action is nothing special just:
/**
  * @param \JPG\Media\Domain\Model\Item $newItem
  * @return void
  */
public function createAction(Item $item) {
	$this->itemRepository->add($item);
	$this->addFlashMessage('Created a new item.');
	$this->redirect('index');
}


and inside my Model there is just:
[...]
/**
  * @var \TYPO3\Media\Domain\Model\Image
  * @ORM\OneToOne(cascade={"all"}, orphanRemoval=true)
  */
protected $image;
[...]
/**
  * @param \TYPO3\Media\Domain\Model\Image $image
  * @return void
  */
public function setImage($image) {
	$this->image = $image;
}

/**
  * @return \TYPO3\Media\Domain\Model\Image
  */
public function getImage() {
	return $this->image;
}
[...]


It's just my small lerning project, but i think this is an important task.

Cheers,
Jan


More information about the Flow mailing list