Hello.
I read about this subject too.
In my view form i use:
$form->create('Geo_objectos',array('enctype'=> 'multipart/form-
data','action'=>'save'))
and , for the form i use:
<input type="file" name="ficheiro[]">
One array for file name.
Than in the controller i have $ficheiro as an array of files (or just
one), with all the info of the file (size, name, temp name etc.)
I tried to use $form->file, does't work for me because the $form-
>create was not correct, i have to use "array('enctype'=> 'multipart/
form-data')" to make it work,..
I don't use $form->file because i have a component, file handler that
need <input type="file" name="ficheiro[]"> to work.
I hope i have helped you.
Good bye
On 14 Jul, 16:46, Gorka <[EMAIL PROTECTED]> wrote:
> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---