使用JavaScript检查文件夹中是否存在文件 [英] Check File exist in Folder using Javascript

查看:62
本文介绍了使用JavaScript检查文件夹中是否存在文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要检查文件夹中是否存在文件.下面的代码是我尝试多次无法正常工作的时候.

I want to check a file exist in folder. Below code is while i'm trying to many times is not working.

<!DOCTYPE html>
<html>
<head>
<script>
function Start()
{
var path = "X:\ApplicationFiles\Journals\TandF\RJHR\Vol00000\180008\ML\IProof\TF-RJHR180008.xml";
if (File.Exists(path))
{
document.getElementById("Stage").innerHTML = "exists";
}
}
</script>
</head>
<body>
<table border="1">
<thead>
<tr><th>Job ID</th><th>JID</th><th>Article ID</th><th>Intrnl ID</th><th>Due Date</th><th>Current Status</th></tr>
</thead>
<tbody>
<tr><td>T76825</td><td>RJHR</td><td>1445583</td><td>180008</td><td>01-Mar-18</td><td><p id="Stage"/></td></tr>
</tbody>
</table>
</body>
</html>

推荐答案

这将不起作用,因为您的浏览器无法访问您的文件系统.

This wont work because your browser does not have access to your file system.

您可以从node.js服务器运行它

you can run this from a node.js server

请参见 https://en.wikipedia.org/wiki/JavaScript#Security

这篇关于使用JavaScript检查文件夹中是否存在文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆