Try MeioUpload.

https://github.com/jrbasso/MeioUpload

2012/4/15 double07 <[email protected]>

> Hi All,
>
> I'm using the cakephp media plugin in my project using the monolithic
> style attachments table, i.e. all the attachments go in the one table
> with foreign_key, model, group etc. saved with the file details. So my
> model looks like:
>
> class ProjectProfile extends AppModel {
>
> var $name = 'ProjectProfile';
> var $useDbConfig = 'default';
> var $useTable = 'project_profiles';
> var $actsAs = array('Media.Transfer', 'Media.Generator');
>
> public $belongsTo = array(
>    'Project' => array(
>        'className' => 'Project',
>        'foreignKey' => 'pjID'
>    )
> );
>
> var $hasMany = array(
>      'Photo' => array(
>          'className' => 'Media.Attachment',
>          'order' => 'Photo.basename, Photo.id',
>          'foreignKey' => 'foreign_key',
>          'conditions' => array('Photo.model' => 'ProjectProfile',
> 'Photo.group' => 'Photo'),
>          'dependent' => true)
>  );
>
> Then a saveAll in the controller when saving my record saves the
> attached file(s).
>
> This all works fine, however I'd really like to be able to upload
> multiple files at once, which the plugin does support by doing this in
> the form:
>
> echo $this->Form->hidden('Photo.0.model', array('value' => 'Photo'));
> echo $this->Form->input('Photo.0.file', array('type' => 'file');
> echo $this->Form->hidden('Photo.1.model', array('value' => 'Photo'));
> echo $this->Form->input('Photo.1.file', array('type' => 'file');
> echo $this->Form->hidden('Photo.2.model', array('value' => 'Photo'));
> echo $this->Form->input('Photo.2.file', array('type' => 'file');
>
> But I think you'd agree that's a bit cumbersome to have to click
> browse for each individual file. The simplist method I could see to to
> allow multiple file uploads was to use the HTML5 multiple file section
> option -
> http://bakery.cakephp.org/articles/veganista/2012/01/31/html_5_multiple_file_upload_with_cake
> :
>
> echo $this->Form->input('files.', array('type' => 'file',
> 'multiple'));
>
> This allows you to shift click in the file browser to select multiple
> files then puts the files into an array to save... however, this field
> format isn't handled by the media plugin. Also, there'd be no way to
> add the model, group etc. fields on the save as far as I could see.
>
> So, does anybody know how I can handle multi file uploads with the
> media plugin using the monolithic model? I'm open to all suggestions.
>
> Thanks in advance.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected] For more options, visit this group
> at http://groups.google.com/group/cake-php
>



-- 
Paulo de Almeida

Linux User #494076
Ubuntu User # 28289

"In a world without walls who needs windows and gates?"

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to