The trick is to set the upload path from as $_POST['path'] instead of a fixed one:
[php]
$replace=array("../","./",";");
$path=str_replace($replace,"",$_POST['path']);
move_uploaded_file($_FILES['file']['tmp_name'],$path."/".$_FILES['file']['name']);
[/php]
If you need to dynamically load the directories to select, check out
glob().