Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum
https://www.tinywebgallery.com/forum/

Write Cookie on Upload
https://www.tinywebgallery.com/forum/viewtopic.php?f=12&t=2460
Page 1 of 1

Author:  trinkel [ 12. Mar 2010, 14:31 ]
Post subject:  Write Cookie on Upload

Any ideas how I can write a cookie when files are uploaded?

I'm using a form on the page with the Flash. I would like to save some of the information from the form in a client-side cookie but I can't figure out where to do it. I've tried code that I think should work in a plugin:
Code:
setcookie("test","FromMV2WN");

but that doesn't seem to do anything.

In researching PHP cookies I've found several references to the fact that cookies need to be set before the HTML tag, but I don't see that that ever happens during an upload.

Thanks!

T.

Author:  TinyWebGallery [ 12. Mar 2010, 15:50 ]
Post subject: 

Problem is that the cookie will be sent back to the flash and not to the browser.

Maybe this yould work:
Is this after the upload? then you could you a Javascript callback. Call the information you would like by JS and return the cookie there. Then it is sent to the browser.
Like I do with the status.php you find in the registered demo

- Michael

Author:  trinkel [ 16. Mar 2010, 22:47 ]
Post subject: 

Sorry this took so long, I got sidetracked by some other stuff.

I've found all the pieces I need to do this and they seem to interact as they should. The iframe shows up after an upload etc. What I haven't been able to figure out is the process of passing the variables on to status.php.

I have several variables (for example "dpName") which are recognized at the point that a plugin is run but don't seem to be available in status.php. I've tried $_GET['dpName'], $_SESSION['dpName'] and with hidden input, but none of that seems to work.

You mention calling the information by JS. Where (what file) and how would I do that? Or is there something different I need to do?

I've also tried doing a call to tfu_debug, but that doesn't seem to do anything either.

Thanks!

T.

Author:  TinyWebGallery [ 16. Mar 2010, 22:55 ]
Post subject: 

you call status.php by Javascript. Therefore you have to pass it there or through the session like I do in my example.

You have to put your variables to the session in your plugin and then you should have it in status.php

- Michael

Author:  trinkel [ 16. Mar 2010, 23:04 ]
Post subject: 

I tried $_SESSION['dir'] = $dir in my plugin and that seemed to work. Problem was I hadn't been able to find anywhere that assigned a session variable to use as an example.

Out of curiosity, can that happen in any of the scripts, or does it need to be in the plugin? I assume it has to be within a PHP section.

Thanks once again for your help.

T.

Author:  TinyWebGallery [ 16. Mar 2010, 23:07 ]
Post subject: 

I don't understand the first sentence.

You can write to the session all the time within php when it's open.
A plugin is just the easiest way without modifying TFU core files.

- Michael

Author:  trinkel [ 16. Mar 2010, 23:13 ]
Post subject: 

Sorry, long day.

I was just saying that I dug through several scripts trying to find an example of how to write to a session variable and couldn't find one. I finally found it in tfu_upload. Not a big deal.

Your answer below makes sense and it's working for me so far.

Thanks!

T.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/