PDA

View Full Version : Unique session ID


kdawg
07-06-2007, 09:20 PM
Here is the scenario. I have a SWF that lets users upload photos via the FileReference class. The problems. I need to be able to replace or append a unique variable to the file name so one–I can track the image and two–if someone uploads a file with the same name it doesn't overwrite an existing file with the same name.

I'm and AS guy so server side scripting isn't my cup of tea but I'm game. So if anyone could help me out and talk REALLY slowly I'd be much obliged. This seems like a very typical scenario but I don't know where to begin. Perhaps I could append the variable at the end of the URL, using a cookie, then pass it into Flash? Although I haven't the faintest clue how to use a cookie.

The server is equipped with the typical PHP/CGI/mySQL. I'm using Flash 8.

hobbis
07-07-2007, 12:48 AM
At some stage you need to tell the server script e.g. PHP the name of the file. To keep it unique, use the time() function. Something like this:

$field1_filename = time() . $field1_filename;

Check out the move_uploaded_file() in the PHP docs.

Sorry I can't help with the actionscript FileReference class as I haven't used it yet.