下载文件:ACCESS DENIED
Download file: ACCESS DENIED
点击下载按钮后,我一直保持"访问被拒绝"状态。我已经完全控制了指定的文件夹。
我在jquery中使用了这个。
function DownloadFile(ProductNumber, File)
{
var windowSizeArray = ["width=400,height=400",
"width=500,height=600,scrollbars=yes"];
File = "C:/Documents and Settings/My PC/My Documents/" + File;
if (File != "")
{
var windowName = "popUp";
var windowSize = windowSizeArray[$(this).attr("rel")];
var exist = isExists(File);
if (exist)
{
window.open(File, windowName, windowSize);
}
else
{
ShowAlertMessage("The file for Product no. <a href='" + File + "' target='blank'>" + ProductNumber+ "</a> does not exist.");
}
}
else
{
ShowAlertMessage("No PDF file for Product no: " + ProductNumber+ ".");
}
}
您不能像在代码段中那样访问本地文件。
您必须将文件上传到服务器,并使用PHP/另一种服务器端语言来完成此操作。jQuery(或Javascript)仅在浏览器中运行,无法访问外部文件。服务器端web语言只能访问服务器上的文件(或使用get_file_contents或cURL的其他服务器)。
您的代码看起来像一个C#/Java源代码。他们可以访问这些本地文件。
相关文章:
- 如何解决Access Control Allow Origin错误
- 由于响应中不存在“Access Control Allow Origin”标头,跨域请求停止工作
- 使用JavaScript插入Access数据库
- AWSELB Cookie access from Javascript
- XMLHttpRequest : 不被 access-control-allow-origin 所允许
- HTML将数据保存在Access中
- 使用 node.js 设置 Microsoft Access 数据库连接
- 来自 MS Access 的 JavaScript 陷阱为空
- linux php exec() msgget:Permission Denied
- 可以在Access Control Allow Origin中指定端口
- NodeJS”;进行测试”;返回一个Permission denied
- Access Control Allow Origin阻止我访问google api,尽管使用了dataType:
- JSONP跨原点错误'不存在Access Control Allow Origin标头'
- 角度:原点http://localhost在Access Control Allow Origin标头中找不到
- Angular$resource调用不被Access Control Allow使用Safari接受,而被Chrome接
- Instagram API access_token request and Access-Control-Allow-
- 方法不允许 — 从 Angularjs 中的请求标头中删除 Access-Control-Request-Method
- 下载文件:ACCESS DENIED
- Yahoo - OAuth2 - SocialAPI:在初始响应中不返回“Access-Control-Allow-Or
- 通过编程方式在iframe中选择一个输入类型的文件,然后上传会给出Access is denied错误