开发者

javascript checking path already exists [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying t开发者_如何学编程his question so that it can be reopened, visit the help center. Closed 12 years ago.

how would i check if the file path already exists in javascript


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, ...).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜