Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Is there any example of swfupload
  • When I try to use swfupload. I got #2038 Error.
  • Many of the Flash file uploader have the problem when using Apache Http Mod_rewrite .

    Write a direct accessible file in your public folder to handle the SWFUpload request.
    You can then use CURL to pass the data to your framework.
  • This uses uploadify, but that's flash also. Perhaps it can give you some pointers.

    https://github.com/huglester/fuel-uploadify
  • I set upload_url to a action named  'testupload',

    127.0.0.1 - - [24/Dec/2012:18:33:28 +0800] "POST /admin/softwares/testupload HTTP/1.1" 302 -
  • but I set it to a direct  accessible file in my public folder. it works.

  • Maybe It is PHPSESSID reasons, I use the no auth action, it works, too.

    But I point the PHPSESSID for the requet of  swfupload.
    post_params: {"PHPSESSID": "<?php echo Session::key('session_id'); ?>"},
    It also return 302

    How can I pass the session_id so that keeping the session
  • FuelPHP doesn't use PHP sessions, so passing PHPSESSID is pointless. See http://docs.fuelphp.com/classes/session/advanced.html on how to deal with sessions and Flash objects.

    If you see a 302, something is doing a redirect, either a rewrite rule or a redirect in your code. Assuming "/admin/softwares/testupload" is a controller called Softwares with a method called testupload(), it should give you a 200, not a 302.
  • hewenxiang,

    Yes, it is the session problem. Flash don't read the cookies info from the web as the session id is stored in cookies. Instead, it keep it's own set of cookies info.

    The sample provided by Harro Verton (using Uploadify) has the JavaScript code to get the session info and attach to the Flash before submit.

    I tried to search for solution how to attach the session id into SWFUpload and I get this:

      swfu = new SWFUpload ({
          ... //some other settings
          post_params: {
            "<session_id_key>" : "<session_id>"
          }
        });

    The session_id_key is set in the session.php depends on which driver is in used:
      ...
        "cookie_name" => "fuelcid", 
      ...



    You can use the JavaScript function "getCookie" in http://docs.fuelphp.com/classes/session/advanced.html to retrieve the session info from the cookies.


  • 'formData'       : {'fuelcid': getCookie('fuelcid')}

    I try to use uploadify and point the formData 'fuelcid' the cookie_name.

    But it still return HTTP 302 Error.

    I use the Auth package to validate

    if ( ! Auth::member(100) and Request::active()->action != 'login')


    When I coment this line generated by oill, It works。

    Why it still can not verify ?
  • HarroHarro
    Accepted Answer
    The Session driver needs to know what to look for in the posted data.

    This is defined in your session config file. "post_cookie_name" most contain the post variable name that contains the cookie, in this case it should be set to "fuelcid".
  • Thks. It works.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion