CodeIgniter + uploadify + Session Cookie (Flash)
This guide has been written for CI 2.1.0, it can easily be edited for prior versions.
1. Extend CI_Session
Create a MY_Session.php under /application/libraries or extend your own one. Copy the whole sess_read() function from /system/libraries/Session.php and paste it into your newly created MY_Session.php.
2. Session Library Setup
Setup your Session Library properly (add an encryption_key in your config.php) and enable table based sessions as well as disable sess_match_useragent in config.php (important!)
3. In your view where uploadify is embedded, you will have to append post params to your upload function. Here is a sample code:
This has to be parsed by your PHP parser in order to fill the values. You could also just declare a variable like
var browser_cookie = “<?= trim…....... ?>”
and just load this global variable in your upload function.
4. How does it work?
Basically it generates an encrypted version of your session cookie and posts it to your server. As you have already modified the session class, it recognizes that your session cookie has been sent via post and is using this instead. Basically it’s just a simulation of what the browser would do if it wasn’t Flash.
5. Conclusion and caveats
If CI Basis is updated, don’t forget to update your MY_Session as well. It is just ensuring that.
Make sure that your cookie is valid before sending the files to your server. Otherwise you could raise the value of “sess_time_to_update” in your config.php.
출처 : https://ellislab.com/forums/viewthread/216227/#999189
'프로그래밍' 카테고리의 다른 글
|codeigniter IE9 세션 버그 (0)||2015.02.24|
|jqueryUI tab에 구글맵 삽입시 유의점 (0)||2010.12.30|
|Linux 및 Windows 환경을 위한 PHP, Oracle 10g Instant Client 설치 (0)||2010.09.27|