I also implemented swfupload and had problems with the session being
lost. Instead of hacking the cake core I went ahead and included a
unique hashed key with the post. After it was posted, the site would
check the key. If it was valid it would let it go through.

For instance, in the swfupload javascript you could do something like
this:

upload_url: "/foo/edit/56/56/<?=sha1('putYourUniqueSeedHere')?>"

Then in your edit method:

function edit($param1, $param2, $key)
{
    if ($key == sha1('putYourUniqueSeedHere'))
    {
        //upload file
    }
}

I'm sure there are better ways to do this, but I just didn't want to
change the cakephp core.

On Jan 14, 5:56 pm, Adam Royle <[EMAIL PROTECTED]> wrote:
> I had issues with implementing SwfUpload, and it was due to cake's
> security handling of sessions. This was because the swf was sending a
> different user agent and cake detected this as session hijacking.
>
> I might assume that this is happening to you and the redirect (302)
> error you're having is due to cake not recognising some session
> variable (because it's using a new session) and then redirecting to a
> login form?
>
> My solution was to hack the cake core, but I think they have since
> changed the core so you can easily disable this code in your
> beforeFilter().
>
> This should work - but it's untested so let me know if it does.
>
> function beforeFilter(){
> Configure::write('Session.checkAgent', false);
>
> }
>
> Hope that helps.
>
> Cheers,
> Adam
>
> On Jan 15, 7:00 am, booboobenny <[EMAIL PROTECTED]> wrote:
>
> > swfupload does not need ajax,  its pure flash. The flash movie does a
> > post submission there is no page reload.
>
> > The flash movie is getting back a 302 from apache, in the log i see:
>
> > "POST /foo/upload/ HTTP/1.1" 302 673 "-" "Adobe Flash Player 9"
>
> > Note the actual URL of the page is /foo/edit/56/56
>
> > Its very strange that I can set the header manually on local machine
> > but not on mediatemple. They do have a funky way of running php5.
>
> > Well if i figure this out Ill post, this would seem to be a common
> > occurance with this.
>
> > On Jan 14, 1:21 pm, rloaderro <[EMAIL PROTECTED]> wrote:
>
> > > On Jan 14, 8:47 am, booboobenny <[EMAIL PROTECTED]> wrote:
>
> > > > I am hoping someone here can help me out with this one.
>
> > > > I am using swfupload and cake, I implemented using the articles on the
> > > > bakery as a starting point.
>
> > > > I have a controller /foo and in that controller I have a method
> > > > upload. So the upload url is:
>
> > > > /foo/upload
>
> > > > When the form submits I get a 302 error. Does anyone know a way to
> > > > submit the form (i would prefer to avoid ajax) to /foo/upload and not
> > > > get a 302 error.
>
> > > I think the SwfUpload is meant specifically for use with AJAX. The
> > > problem with AJAX and file uploads is that you normally need to submit
> > > the form in order to send file data to the server. Since the page
> > > reloads with a form submit the only previous solution was to submit
> > > the form to a hidden iframe and parse the server response when the
> > > iframe loads. Flash is actually a great interface for uploading files
> > > since it doesn't require a form submit and can even provide feedback
> > > in so far as upload progress, etc.. I don't think using SwfUpload
> > > without AJAX would provide any benefits over using a conventional form
> > > file input - if it even is possible.
>
> > > Anyway, I implemented a similar thing using Mootools and
> > > Swiff.Uploader and I can tell you that using the controller->log
> > > function is invaluable for debugging. My implementation is a little
> > > different than the one on the bakery, but if it helps, my controller
> > > looks like:
>
> > >http://pastebin.com/f457cfcf
>
> > > And the component looks like:
>
> > >http://pastebin.com/f2a167234
>
> > > You might notice my implementation is for single files only - however
> > > I have tested it on a number of server setups - with PHP in safemode,
> > > root-jailing, etc.. - and it has worked for me so it might be useful
> > > for you? Good luck!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to