Tuesday, March 2, 2010

file upload with ajax

Hi all,

I'm trying to upload images with ajax. But in my controller in this-
>data only the values of the text input fields arrive, but not the
file array. Without ajax, everything works perfect.

Here is my view:

<?php echo $ajax->form(array('type' => 'file',
'options' => array(
'model'=>'Image',
'update'=>'image_box',
'url' => array(
'controller' => 'images',
'action' => 'add'
)
)
));
?>
<fieldset>
<legend><?php __('upload image');?></legend>
<?php
echo $form-
>input('Image.file',array('type'=>'file','label'=>__('upload
image',true)));
echo $form->input('Image.title',array('label'=>__('image
title',true)));
echo $form->end(__('upload',true));
?>
</fieldset>

Instead of $form->end I also tried with $ajax->submit (and $form-
>create(), because ajax->submit and $ajax->form together cause a known
issue)

I couldn't find much about file upload with ajax in cake

Any ideas?

Thanks

Donnerbeil

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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

No comments: