Setting PHP session variables using Flash Actionscript

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2009-06-17T12:41:42Z Indexed on 2010/05/30 17:32 UTC
Read the original article Hit count: 154

Filed under:
|
|

Hello all,

I have a simple PHP upload script that is called from my Flash App. I am sure it makes the call because it actually uploads the file!

session_start();

$default_path = 'files/';

$target_path = ($_POST['dir']) ? $_POST['dir'] : $default_path;

if(!file_exists($target_path)) mkdir($target_path, 0777, true);

$destination = $target_path . basename( $_FILES[ 'Filedata' ][ 'name' ] );

$file_name =  rand(1,9999).$_FILES[ 'Filedata' ][ 'name' ];

if(move_uploaded_file($_FILES[ 'Filedata' ][ 'tmp_name' ], $destination)){

$_SESSION['path'] = 'flashuploader_online/upload/'.$destination;

}

However, I try to use the session variable "path" in another script but it gives me an empty value! Yes, I have made sure to use session_start.

Am I missing something?

Update

At least now I know what the problem is! But I am not sure how to solve it without it getting messy to pass across session variables. Any ideas?

© Stack Overflow or respective owner

Related posts about php

Related posts about flash