Php photo gallery TWG | JFUploader | TWG Flash upload | WFU | Forum

Get help for TinyWebGallery, the best image gallery. The forum is also home for the Joomla JFUploader, TWG Flash Uploader and the Wordpress flash uploader.
It is currently 23. Oct 2017, 13:44

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Write Cookie on Upload
PostPosted: 12. Mar 2010, 14:31 
Offline

Joined: 9. Feb 2009, 18:16
Posts: 80
Location: Rochester, MN USA
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.


Top
 Profile  
 
 Post subject:
PostPosted: 12. Mar 2010, 15:50 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 10499
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


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2010, 22:47 
Offline

Joined: 9. Feb 2009, 18:16
Posts: 80
Location: Rochester, MN USA
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.


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2010, 22:55 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 10499
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


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2010, 23:04 
Offline

Joined: 9. Feb 2009, 18:16
Posts: 80
Location: Rochester, MN USA
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.


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2010, 23:07 
Offline
Site Admin
User avatar

Joined: 1. Aug 2005, 12:53
Posts: 10499
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


Top
 Profile  
 
 Post subject:
PostPosted: 16. Mar 2010, 23:13 
Offline

Joined: 9. Feb 2009, 18:16
Posts: 80
Location: Rochester, MN USA
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group

phpBB SEO