laidbackwebsage - 7:14 pm on Jan 11, 2014 (gmt 0)
The problem is where you are setting the value of "$dir".
What you are actually doing is setting the value of "$dir" to be equal to the value of "$_POST"; that is why you are seeing a return value of "Array".
What you need to do is something like:
$dir = $_POST['myDirectoryName']