是否有一种(免费)方法可以在 ASP Classic 中解压 .zip 文件而不使用 .DLL

发布于 2024-09-13 16:00:54 字数 237 浏览 5 评论 0原文

我希望能够使用 ASP classic 解压 .zip 文件。

我在谷歌上搜索了一些可以让我做到这一点的东西,并且似乎有相当数量的库在那里。然而,据我所知,所有这些都要求我安装第三方 DLL。

将部署此脚本的服务器(或更准确地说是控制所述服务器的 IT 部门)将不允许我使用这些来扩展 ASP 的功能并执行我被要求执行的操作(完全自相矛盾!)。

是否有任何类库可供我作为包含项添加?

谢谢你的时间

I would like to be able to unpack a .zip file using ASP classic.

I have had a bit of a poke around on google for something that will allow me to do this, and there seems to be a fair amount libraries out there. However all of these as far as I can tell require me to install a third party DLL.

The server that this script will be deployed on (or more accurately the IT department that control said server) will not allow me to use these to extend ASP's functionality and do what I have been asked to do (totally paradoxical!).

Is there any class library's out there that I might just be able to throw in as an include?

thanks for your time

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千纸鹤 2024-09-20 16:00:54

不确定是否可以使其与 ASP 一起使用,但在此 项目< /a> 你会找到一种在 VB 中使用 DLL 来解压的方法,但你不需要注册 DLL,只需将它放在类可以找到它的地方即可。

我已经在 VB 6 编译的应用程序中使用了它,但也许您可以将其改编为 ASP。没有把握。

这是您需要的代码:UnZip.cls< br>
希望有帮助。

Not sure is you can make it work with ASP, but in this project you will find a way to unZip in VB using a DLL, but you don't need to register the DLL, just put it somewhere where the class can find it.

I've used it in a VB 6 compiled app, but maybe you can adapt it to ASP. Not sure.

This is the code you will need: UnZip.cls
Hope it helps.

_失温 2024-09-20 16:00:54

我已经解决了我的问题......它非常混乱,远非理想,并且依赖于服务器设置,但为了将来遇到类似问题和服务器的任何人,这里是我解决它的方法。

基本上,我使用了 PHP 的 ZIP 库,该库似乎安装在我正在处理的服务器上,并制作了一个 unzip.php 文件:

<?PHP

$infile = $_REQUEST['infile'];
$outfile = $_REQUEST['outfile'];

$input_folder = "uploads";
$output_folder = "templates";

echo "false";

$zip = zip_open($input_folder."/".$infile);
if ($zip) {
  while ($zip_entry = zip_read($zip)) {
    $fp = fopen($output_folder."/".$outfile."/".zip_entry_name($zip_entry), "w");
    if (zip_entry_open($zip, $zip_entry, "r")) {
      $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
      fwrite($fp,"$buf");
      zip_entry_close($zip_entry);
      fclose($fp);
    } else {
    echo "false";
    exit;
    }
  }
    echo "true";
  zip_close($zip);
} else {
    echo "false";
    exit;
}

?>

然后,我想在我的 ASP 脚本中调用它,我将 HTTPXML 发送到同一位置上的 PHP 文件位置服务器将我的变量作为查询字符串的一部分。

Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://" & strdomain & "/unzip.php?infile="& filename &"&outfile=" & out_foldername, False
xml.Send
if xml.responseText = "true" then
    SaveFiles = SaveFiles & "(unzip successful!)"
else
    SaveFiles = SaveFiles & "(unzip failed!)"
end if
Set xml = Nothing
next

我确信一定有一种更好的方法来做到这一点

filename     =   The name of the file that you want to unzip
out_folder   =   The name of the folder that you want put your unzipped files into
strdomain    =   Request.ServerVariables("HTTP_HOST")
SaveFiles    =   my return variable.

,但目前在我的情况下,这似乎工作正常(希望没有人会知道!)。

I have solved my problem... it's pretty messy, far from ideal, and dependant on server set up, but for the sake of anyone that has a similar problem and server in future here is how I solved it.

Basically I used PHP's ZIP library which seems to be installed on the server that I'm working on and made an unzip.php file:

<?PHP

$infile = $_REQUEST['infile'];
$outfile = $_REQUEST['outfile'];

$input_folder = "uploads";
$output_folder = "templates";

echo "false";

$zip = zip_open($input_folder."/".$infile);
if ($zip) {
  while ($zip_entry = zip_read($zip)) {
    $fp = fopen($output_folder."/".$outfile."/".zip_entry_name($zip_entry), "w");
    if (zip_entry_open($zip, $zip_entry, "r")) {
      $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
      fwrite($fp,"$buf");
      zip_entry_close($zip_entry);
      fclose($fp);
    } else {
    echo "false";
    exit;
    }
  }
    echo "true";
  zip_close($zip);
} else {
    echo "false";
    exit;
}

?>

Then where I wanted to call this in my ASP script I HTTPXML'd to the PHP file location on same server with my variables as part of the querystring.

Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://" & strdomain & "/unzip.php?infile="& filename &"&outfile=" & out_foldername, False
xml.Send
if xml.responseText = "true" then
    SaveFiles = SaveFiles & "(unzip successful!)"
else
    SaveFiles = SaveFiles & "(unzip failed!)"
end if
Set xml = Nothing
next

where

filename     =   The name of the file that you want to unzip
out_folder   =   The name of the folder that you want put your unzipped files into
strdomain    =   Request.ServerVariables("HTTP_HOST")
SaveFiles    =   my return variable.

I'm sure there must be a better way of doing this, but for the time being in my situation this seems to work ok (and hopefully no one will ever know!).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文