how would i check if the file path already exists in javascript
+1
A:
If the path you want to check for existence is on the server you cannot do it using pure javascript. You could set a controller action which returns JSON data indicating if the path exists on the server. This action could be invoked using AJAX:
public ActionResult PathExists(string path)
{
return Json(new { result = Directory.Exists(path) });
}
Remark: beware of the security implications by writing such a method.
If the path you want to check for existence is located on the client machine then this cannot be done unless the client installs some specific plugin (ActiveX, Flash, Silverlight, ...).
Darin Dimitrov
2010-07-06 12:21:59