Hi,
I'm using the same component in CakePHP 1.2 & the latest swfupload
version. It's very tricky and there are many places where stuff can
break. Make use of firebug to check if all paths can be resolved. Use
console logging to see if certain actions are actually executed.

here's my controller logic (stripped out some app specific lines):
        function upload()
        {
                $this->Log('@ /attachments/upload');
                // sharing sessions between flash and browser requests doesn't
                // work in cakephp. we have to hand the session id over in a
                // GET request. for more info, check:
                // 
http://blogs.bigfish.tv/adam/2008/04/01/cakephp-12-sessions-and-swfupload/

                // determine the event from session
                $event_id = $this->get_session_var('current_event_id');

                $this->Log('adding a attachment to existing event stored in the
session, event_id = ' . $event_id);

                if (isset($this->params['form']['filedata'])) {

                        // determine upload path: {upload_path}/{event_id}/
                        $this->SwfUpload->uploadpath = 
Configure::read('upload_path') .
DS . $event_id . DS;

                        // store uploaded file
                        if ($this->SwfUpload->upload()) {
                                // save the attachment to the db
                                $this->data['attachment']['filename'] = 
$this->SwfUpload-
>filename;
                                $this->data['attachment']['event_id'] = 
$event_id;

                                // save file information in the database
                                $this->attachment->save($this->data);

                                // we only want to return the fileid, not cake 
debug output
                                Configure::write('debug', 0);

                                // Return the file id to the JS script
                                echo 'fileID:' . 
$this->data['attachment']['id'];
                                $this->Log('attachment is uploaded, returned 
fileID = ' . $this-
>attachment->id);
                        } else {
                                // storing uploaded file went wrong, report the 
error in the log
file
                                $this->Log($this->SwfUpload->errorMessage);
                        }
                }
                exit();
        }

It's similar to the code published in the bakery article.
Then there's a lot of js code that needs to be included in your upload
view. Make sure you include the right js files. I took
http://demo.swfupload.org/v220/applicationdemo/index.php as a base. In
the inline js code, I've changed the paths like:

$js = 'window.onload = function() {
        var settings = {
                flash_url : "' . $html->url('/files/swfupload.swf') .
'",
                upload_url: "' . $html->url('/pictures/upload/' .
session_id()) . '",
                post_params: {"PHPSESSID" : "' . session_id() . '"},
...etc
';

$javascript->codeBlock($js, array('inline' => false));

Anyway, just some snippets, I don't have a working isolated example.
Again, if you use the (messy) swfupload demo as a starting point, it
get's messy / hairy / complicated.

Have you considered 
http://digitarald.de/project/fancyupload/3-0/showcase/photoqueue/
?

Keep us updated with your progress!!

Bests,

Bram

On Aug 5, 10:11 pm, Robert <mcway_web_des...@cox.net> wrote:
> I've been trying to integrate SWFUpload 2.0.2 with my CakePHP 1.2
> application, and have been stuck for a few days now...after endless
> searching, i've only been able to find solutions such 
> ashttp://bakery.cakephp.org/articles/view/swfupload-and-multipurpose-up...,
> which is for cake 1.1, and swfupload 1.0. Has anyone been able to
> integrate the new swfupload with a cake 1.2 application? Any help in
> the right direction would be much appreciated.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to