You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You did a great job when writing this plugin, but i do have an issue.
I've got multiple file upload fields in my form.
But the user don't have to fill them all.
Your script is making a record though for every one of this file.
How can i solve this?
Hello,
You did a great job when writing this plugin, but i do have an issue.
I've got multiple file upload fields in my form.
But the user don't have to fill them all.
Your script is making a record though for every one of this file.
How can i solve this?
code:
Form->create('Portfolio', array('type' => 'file')); echo $this->Form->input('Portfolio.title', array('label' => 'Titel')); echo $this->Form->input('Photo.0.description', array('label' => 'Beschrijving')); echo $this->Form->input('Photo.0.photo', array('type' => 'file', 'label' => 'Foto')); echo $this->Form->input('Photo.1.description', array('label' => 'Beschrijving')); echo $this->Form->input('Photo.1.photo', array('type' => 'file', 'label' => 'Foto')); echo $this->Form->end('Voeg item toe'); ?>add.ctp -- Portfolio / add
PortfolioController.php -- Portfolio Controller
request->is('post')) { if($this->Portfolio->saveAssociated($this->request->data)) { $this->Session->setFlash('Het portfolio item is toegevoegd.'); $this->redirect(array('action' => 'index')); } else { $this->Session->setFlash('Het portfolio item kon niet worden toegevoegd.'); } debug($this->request->data); debug($_FILES); } } ?>Photo.php -- Photo Model
array( 'photo' => array( 'styles' => array( 'thumb' => '223x112' ), 'path' => ':webroot/img/portfolio/:basename_:style.:extension', 'default_url' => ':webroot/img/portfolio/600x300.gif' ) ) ); public $validate = array( 'photo' => array( 'maxSize' => array( 'rule' => array('attachmentMaxSize', 10485760), 'message' => 'Foto kan niet groter zijn dan 10MB' ) ) ); ``` } ?>The text was updated successfully, but these errors were encountered: