在ASP中如何实现解压ZIP文件?(30分)

  • 主题发起人 主题发起人 folmorse
  • 开始时间 开始时间
F

folmorse

Unregistered / Unconfirmed
GUEST, unregistred user!
不知道有什么好方法?(这个问题太难,本来要200分以上,只可惜我没那么多?)
 
写COM对象实现解压
在ASP中调用
 
COM 详细的还是听大虾系统分析一下吧
 
unit Unit1;

interface

uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl,VCLUnZip,VclZip;

type
TComZip = class(TASPObject, IComZip)
protected
procedure OnEndPage
safecall;
procedure OnStartPage(const AScriptingContext: IUnknown)
safecall;
procedure Unzip(const FileName: WideString)
safecall;
procedure zip(const FileName: WideString)
safecall;
end;

implementation

uses ComServ;

procedure TComZip.OnEndPage;
begin
inherited OnEndPage;
end;

procedure TComZip.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;

procedure TComZip.Unzip(const FileName: WideString);
var
UnZip:TVclUnZip;

begin
UnZip:=TvclUnZip.Create(Nil);
Try
Unzip.zipName:=FileName;
UnZip.DoAll:=true;
UnZip.UnZip;
finally
Unzip.free;
end;
end;

procedure TComZip.zip(const FileName: WideString);
var
Zip:TVclZip;
begin
Zip:=TvclZip.Create(Nil);
Try
Zip.zipName:='Zip.Zip';
Zip.FilesList.Add(FileName);
Zip.Zip;
finally
Zip.free;
end;
end;

initialization
TAutoObjectFactory.Create(ComServer, TComZip, Class_ComZip,
ciMultiInstance, tmApartment);
end.
 
<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<% Set DelphiASPObj = Server.CreateObject("Project1.ComZip")
DelphiASPObj.unZip('c:/temp/zip.zip')
%>
<HR>
</BODY>
</HTML>
 
先给arm大虾送上分再说,多谢arm大虾!(分不多,请大虾见谅!)
等我调试一下程序,不懂的地方还要问你哦!
 
后退
顶部