laidbackwebsage - 7:21 pm on Jan 11, 2014 (gmt 0)
Sorry, I should mention a couple of other things:
It is not good practice to use PHP reserved words as part of variable names or other identifiers. That is why I changed 'dirname' from your form to 'myDirectoryName' in my example.
Also, you should ALWAYS sanitize user input before using it; see [stackoverflow.com ]