Check if an input folder exists or not in PHP or JavaScript
<p>I have a form which takes a couple of text field inputs and then a folder path. 
Now before I submit the form I want to make sure that whatever the folder path the user specified is correct, if not print an error message.</p>

<p>Is there a way I can validate this in the same page before I submit the form?</p>

<p>I used javascript, but it doesnt seem to work as I expected. Thoughts/Suggestions ?</p>

<pre><code>&lt;script&gt;
 function checkfolder()
 {
   var myObject;
   myObject = new ActiveXObject("Scripting.FileSystemObject");
   if(!myObject.FolderExists()){
     alert("Folder does not exist");
    }
  }
&lt;/script&gt;
&lt;form method=post action="some_file.php"&gt;
.
.
.

&lt;input type="submit" name="submit" value="submit" onClick='checkFolder()'&gt;
&lt;/form&gt;
</code></pre>
