Friday, August 29, 2014

Using multiple images with cakephp

Hi, 

I used https://github.com/josegonzalez/cakephp-upload

to make a system to upload multiple images.

All database is ok but when I try this code :

  public $actsAs = array(
      'Acl' => array('type' => 'requester', 'enabled' => false),
      'Translate',
      'Upload.Upload' => array(
        'resume' => array(
          'fields' => array(
            'dir' => 'resume_dir',
            'type' => 'resume_type',
            'size' => 'resume_size',
          )
        ),
        'photo' => array(
          'fields' => array(
            'dir' => 'photo_dir',
            'type' => 'photo_type',
            'size' => 'photo_size',
          ),
          'thumbnailSizes' => array(
                'mini' => '400x350',
          ),
        )
      )
  );

the request data in post returns me :

array(  	'Post' => array(  		'text' => '',  		'id' => '2',  		'users_id' => '2',  		'post_types_id' => '2',  		'owner_id' => '2',  		'has_resource' => '1',  		'photo_dir' => '/files/posts/photo/2/',  		'photo' => array(  			(int) 0 => array(  				'name' => 'IMG_0213_2.jpg',  				'type' => 'image/jpeg',  				'tmp_name' => '/private/var/tmp/phpcrov66',  				'error' => (int) 0,  				'size' => (int) 0  			),  			(int) 1 => array(  				'name' => 'IMG_0217.jpg',  				'type' => 'image/jpeg',  				'tmp_name' => '/private/var/tmp/phpX24eiH',  				'error' => (int) 0,  				'size' => (int) 0  			)  		),  		'resource' => '["\/files\/posts\/photo\/2\/\/IMG_0213_2.jpg","\/files\/posts\/photo\/2\/\/IMG_0217.jpg"]'  	),  	'PostType' => array(  		'id' => '2'  	)  )


But the images does not upload. Anyone knows why ? Thank you !


--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: