Thanks both for your answers, but I'm afraid I didn't make myself
clear. The form enctype was fine, the problem is how to properly set
the file field to be an array instead of a single field, so when the
form is submitted I can manage the multiple files contained in the
field. That way file fields can be added or removed dynamically with
javascript as they are not fixed table fields for the model, but a
relationship with another model that gets managed with a behavior.
* This view:
<?=$form->create('Alojamiento', array('type'=>'file',
'action'=>'add'))?>
<?=$form->input('Alojamiento.nombre', 'Nombre')?>
<?=$form->file('Alojamiento.images')?>
<?=$form->file('Alojamiento.images')?>
<?=$form->submit()?>
<?=$form->end()?>
* Renders this HTML:
<form id="AlojamientoAddForm" enctype="multipart/form-data"
method="post" action="/admin/alojamientos/add/">
<div class="input"><label for="AlojamientoNombre">Nombre</
label><input name="data[Alojamiento][nombre]" type="text" 0="0"
value="" id="AlojamientoNombre" /></div>
<input type="file" name="data[Alojamiento][images]" value=""
id="AlojamientoImages" />
<input type="file" name="data[Alojamiento][images]" value=""
id="AlojamientoImages" />
<div class="submit"><input type="submit" value="Submit" /></div>
</form>
* When I'd like it to render something like:
<form id="AlojamientoAddForm" enctype="multipart/form-data"
method="post" action="/admin/alojamientos/add/">
<div class="input"><label for="AlojamientoNombre">Nombre</
label><input name="data[Alojamiento][nombre]" type="text" 0="0"
value="" id="AlojamientoNombre" /></div>
<input type="file" name="data[Alojamiento][images][]" value=""
id="AlojamientoImages1" />
<input type="file" name="data[Alojamiento][images][]" value=""
id="AlojamientoImages2" />
<div class="submit"><input type="submit" value="Submit" /></div>
</form>
I see no way of forcing $form->file() to specify an array of files and
not a single file. Or maybe I'm doing something terribly wrong?
BTW: What is that 0="0" thing that gets shown in the text input field?
On 16 jul, 13:49, "Dr. Tarique Sani" <[EMAIL PROTECTED]> wrote:
> On 7/16/07, ctimoteo <[EMAIL PROTECTED]> wrote:
>
>
>
> > In my view form i use:
>
> > $form->create('Geo_objectos',array('enctype'=> 'multipart/form-
> > data','action'=>'save'))
>
> @ ctimoteo try $form->create('Geo_objectos', array('type' => 'file'));
> instead of the above line
>
> HTH
>
> T
>
> --
> =============================================================
> Cheesecake-Photoblog:http://cheesecake-photoblog.org
> PHP for E-Biz:http://sanisoft.com
> =============================================================
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---