[TYPO3-mvc] Images and extbase

Henjo Hoeksma me at henjohoeksma.nl
Fri Oct 19 11:30:05 CEST 2012


Hi Mario,

the annotation is fine.

The whole message you receive is because extbase doesn't handle file uploads out of the box, you need to write support for that in your controller.

For example something like this:

		/**
		 * action update
		 *
		 * @param $product
		 * @return void
		 */
		public function updateAction(Tx_SimplyShop_Domain_Model_Product $product) {
			$arguments = $this->request->getArguments();
			$imagesNew = array();
			if($arguments['product']['images']) {
				$imagesNew = $arguments['product']['images'];
			}
			if (!empty($_FILES['tx_simplyshop_management']['name']['product']['images'])) {
				$files = Tx_SimplyShop_Services_ArrayServices::arrayFilterRecursive($_FILES['tx_simplyshop_management']['name']['product']['images']);
				$filesTemp = Tx_SimplyShop_Services_ArrayServices::arrayFilterRecursive($_FILES['tx_simplyshop_management']['tmp_name']['product']['images']);
				$basicFileFunctions = $this->objectManager->create('t3lib_basicFileFunctions');
				foreach ($files as $key => $file) {
					$fileName = '';
					$fileName = $basicFileFunctions->getUniqueName($file, t3lib_div::getFileAbsFileName('uploads/tx_simplyshop/products/' . $fileName));
					t3lib_div::upload_copy_move($filesTemp[$key], $fileName);
					$imagesNew[] = basename($fileName);
				}
			}
			$imagesNew = implode(',', $imagesNew);
			$product->setImages($imagesNew);
			$this->productRepository->update($product);
			$this->flashMessageContainer->add('Your Product was updated.');
			$this->redirect('list');
		}

Cheers,

Henjo

On Oct 18, 2012, at 10:10 PM, mario chiari <m at mariochiari.net> wrote:

> Hi,
> 
> 
> I am trying to port a FLOW3 extension to TYPO3.
> My model includes:
> 
> 	/**
> 	 * The logo
> 	 * @var \TYPO3\FLOW3\Resource\Resource
>        * @ORM\ManyToOne
>        * @FLOW3\Validate(type="NotEmpty")
> 	 */
> 	protected $logo;
> 
> Extabase builder warns me that "All types with * [image]  are not yet
> supported by the frontend form generation\/validation" and just
> generates.
> 
> 	/**
> 	 * Logo image
> 	 *
> 	 * @var string
> 	 * @validate NotEmpty
> 	 */
> 	protected $logo;
> 
> I guess I may fix the code somehow, but I am not sure where to learn how
> to write annotations for extbase. I am not able to seek within
> http://typo3.org/api/typo3/namespace_extbase.html 
> 
> Help is welcome 
> 
> thanks
> cheers
> mario
> 
> 
> 
> 
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list