4 This plug in automatically gets all the cookies for this site and adds them to the post_params.
5 Cookies are loaded only on initialization. The refreshCookies function can be called to update the post_params.
6 The cookies will override any other post params with the same name.
10 if (typeof(SWFUpload) === "function") {
11 SWFUpload.prototype.initSettings = function (old_initSettings) {
12 return function (init_settings) {
13 if (typeof(old_initSettings) === "function") {
14 old_initSettings.call(this, init_settings);
17 this.refreshCookies(false); // The false parameter must be sent since SWFUpload has not initialzed at this point
19 }(SWFUpload.prototype.initSettings);
21 // refreshes the post_params and updates SWFUpload. The send_to_flash parameters is optional and defaults to True
22 SWFUpload.prototype.refreshCookies = function (send_to_flash) {
23 if (send_to_flash !== false) send_to_flash = true;
25 // Get the post_params object
26 var post_params = this.getSetting("post_params");
29 var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value;
30 for(i = 0; i < ca_length; i++) {
34 while (c.charAt(0) == " ") {
35 c = c.substring(1, c.length);
37 eq_index = c.indexOf("=");
39 name = c.substring(0, eq_index);
40 value = c.substring(eq_index+1);
41 post_params[name] = value;
46 this.setPostParams(post_params);