I've checked the API for Cake 1.2 and I see no way of doing this
within the formHelper. Of course I could just directly write the HTML
on the view, but I'm curious to see if there is a better way of doing
this.

When using form->file('Article.image') you get the following HTML:

<inpur type="file" name="data[Article][image]" value=""
id="ArticleImage" />

It is just fine if each file is mapped to a model attribute and a
single field on the data base. But what if you want to retrieve a file
array like the following?

<input type="file" name="data[Article][images][]" value=""
id="ArticleImages" />
<input type="file" name="data[Article][images][]" value=""
id="ArticleImages" />

This would generate an array to be parsed by the model or a behavior
as $model->data['Article']['images'], which is much more comfortable
to use than multiple fields on the model. Of course the HTML attribute
'id' should be fixed to validate, but that is another story and could
be as simple as specifying the id in the form->file() call.

Specifying the name atribute on the form->file() call doesn't work,
BTW. It generartes "data[Article][images[]]" as a name.

Is there a simple way of doing this apart from directly writing the
HTML without using the helper? Should form->file() set the name as it
does when it is specified or is this something that could be reported
to be fixed?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to