开发者

Is there a (free) way to unpack .zip files without the use of a .DLL in ASP Classic

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 insta开发者_StackOverflow中文版ll 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


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.


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜