<<< Back to the TFU FAQ
16. How to pass parameters from your application to the flash
If you want to pass parameters from your application your can not do this directly by adding parameters to the flash because a request can be easily changed and this is not very secure. Especially if you want to set something like the upload directory. Howto 15 showed how to send form fields with the upload but the best way is to pass parameters over the session. The following short example shows how to do this with the upload folder:
1. Include the flash into a php page and set the directory into the session. You can of course set the directory anytime before.
Please note: If you pass variables over the session the parameter session_id is mandatory because Firefox does not handle this properly otherwise!
$_SESSION['mydir'] = 'upload';
<include the flash here>
It's best to close the session before you include the flash because depending on the page caching it is possible the the flash is loaded before the session is written to the disk (which is done at the end of the php file normally)
2. Get the data from the session and make it available for the flash: You can do this directly in tfu_config.php but I recommend to use a file called my_tfu_config.php (this does not exist - you have to create this) which is read by tfu_config.php and should only contain your settings. In our example this file does then look like this:
$folder = $_SESSION['mydir'];
You can extend this example to pass anything you need in e.g. tfu_login.php or tfu_upload.php. If you only pass additional parameters you should also check out the plugin page because this is the easies way to get them without modifying any tfu files directly