I have some fairly straightforward AS3 code that uploads a file to my server:
And the PHP upload script:
boothsEdit1File = new FileReference();
var imgFileTypes:FileFilter = new FileFilter("Imgs (*.jpg, *.png)", "*.jpg;*.png;");
boothsEdit1Status.text = "Banner uploading please wait...";
var requestUpload:URLRequest = new URLRequest(boothsEdit1UploadScript);
boothsEdit1Status.text = "Banner successfully uploaded";
This all works great but my problem is, many users will be uploading their banners to this system and so I don't want them all in the same directory (/files) as the chances are they will be called banner.jpg etc.
if(!is_dir("./files")) mkdir("./files", 0755);
In the Flash code I am then saving the url of the uploaded banner as "domain.com/files/filename" as this needs to be stored.
So I would ideally like to use a unique ID for the directory. E.g. if I am using the system with my user ID of 156...it could upload my banner in to a folder called files156.
The problem I have is, how can I pass that ID number to the PHP upload script? How can I add a variable called 'id' to my Flash code so that my PHP code can receive it using POST?
Any ideas appreciated.