开发者

ActiveX .exe File Download

I am working on a Web Installer for one of my projects and need to be able to download the .exe files using ActiveX. I do not want any dialogs prompting the user to do something with the download. After the user approves the ActiveX, I want the files to be downloaded to the proper place, say C:\TEST.

Any ideas?

This is what I have so far:

<?php

$filename = "WebLock.exe";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>

<html>
<head>

<title>Test</title>
</head>
<body>
<center><b&g开发者_StackOverflowt;Downloading Required Files...</b></center>
<script>
function IEsave(filename, sData) {
    var fso, a;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    file = fso.CreateTextFile(filename, 2, false);
    file.write(<?php echo $contents ?>);
    file.Close();
    return file;
}

alert(IEsave("C:\\WebLock.exe", ""));

</script>
Complete!
</body>
</html>

The only problem is, it doesn't write the file.


Here is the actual page:

Here is the published page!


You cannot write a file to any location due to IE’s Protected Mode feature, even if you write your own plug-in.

I had the same problem and my solution was writing files to low integrity location and calling shell’s SHFileOperation for making copy with UAC dialog.

But If possible, you can try to add your site to trusted list for all of your users.

Here is related question: IE Protected Mode Problem?!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜