Lets take a step back for a moment.
Can you get the upload to work without trying to dynamically set the upload folder name?
We need to first determine if it is a problem with uploading, or the dynamically named folder.
If you can get the upload to work without the dynamically named folder, then try again using the recordset. If your still having problems, add the php page to a zip file and attach it to your reply so I can see the entire code on the page including the recordset.