 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Lee J Cook Guest
|
Posted: Mon Dec 15, 2003 4:16 pm Post subject: Simple CGI application |
|
|
Hi
I have a simple CGI application and I was wondering if there was a way of
letting my application decompress a .zip file on the server?
Any help please
regards
Lee
|
|
| Back to top |
|
 |
Dave Hackett Guest
|
Posted: Tue Dec 16, 2003 12:42 am Post subject: Re: Simple CGI application |
|
|
Google for a Delphi component called TZip. It's a wrapper for the free
Zip.dll and UnZip.dll. I've successfully used these inside an ISAPI. EXCEPT
under the new MS Server 2003. Grrr.
DaveH
"Lee J Cook" <lee.cook (AT) kwikhols (DOT) co.uk> wrote
| Quote: | Hi
I have a simple CGI application and I was wondering if there was a way of
letting my application decompress a .zip file on the server?
Any help please
regards
Lee
|
|
|
| Back to top |
|
 |
Lee J Cook Guest
|
Posted: Tue Dec 16, 2003 9:34 am Post subject: Re: Simple CGI application |
|
|
Dave,
Thanks for the reply i have found the Tzip component, could u give me a code
example of how you set it up to work in your ISAPI,
thanks again
Lee
"Dave Hackett" <dave.hackett (AT) ns (DOT) sympatico.com> wrote
| Quote: | Google for a Delphi component called TZip. It's a wrapper for the free
Zip.dll and UnZip.dll. I've successfully used these inside an ISAPI.
EXCEPT
under the new MS Server 2003. Grrr.
DaveH
"Lee J Cook" <lee.cook (AT) kwikhols (DOT) co.uk> wrote in message
news:3fddde78 (AT) newsgroups (DOT) borland.com...
Hi
I have a simple CGI application and I was wondering if there was a way
of
letting my application decompress a .zip file on the server?
Any help please
regards
Lee
|
|
|
| Back to top |
|
 |
Dave Hackett Guest
|
Posted: Mon Dec 22, 2003 5:44 am Post subject: Re: Simple CGI application |
|
|
Sure. In this case, I had an ISAPI module zip up my data files and send it
to me as a backup.
var
FileStream: TFileStream;
Zip : TZip;
IniFile : TIniFile;
FName : PChar;
IsapiFileName, IsapiPath, IsapiDllName : string;
ZipFileName : string;
begin
{determine the name and path of this ISAPI DLL}
FName := StrAlloc(255);
try
GetModuleFileName(HInstance, FName, 255);
IsapiFileName := StrPas(FName);
IsapiPath := ExtractFilePath(IsapiFileName);
IsapiDllName := ExtractFileName(IsapiFileName);
finally
StrDispose(FName);
end;
{get the data folder to backup from the ini file}
IniFile := TIniFile.Create(IsapiPath + 'Backup.ini');
try
DataFolder := IniFile.ReadString('Data', 'Folder', '');
ZipFileName := IniFile.ReadString('Data', 'ZipFileName', '');
finally
IniFIle.Free;
end;
{zip all files in the folder}
Zip := TZip.Create(nil);
Zip.ShowProgressDialog := false;
Zip.Filename := DataFolder + '' + ZipFileName;
Zip.FileSpecList.Add(DataFolder + '*.*');
Zip.AddOptions := [aoRecursive, aoFolderEntries, aoUpdate];
Zip.ZipComment := 'ServiceReq data backup from Prod (' +
FormatDateTime('dd-mmm-yyyy hh:nn AM/PM', Now) + ')';
Zip.Add;
if Zip.Cancelled then
raise Exception.Create('Could not backup data.');
FileStream := TFileStream.Create(DataFolder + '' + ZipFileName,
fmOpenRead);
if Assigned(FileStream) then
begin
Response.ContentType := 'application/octet-stream';
Response.ContentLength := FileStream.Size;
Response.SetCustomHeader('Content-Disposition', 'attachment;
filename=' + ZipFileName);
Response.ContentStream := FileStream;
Response.SendResponse;
end
else
raise Exception.Create('Could not get file');
end;
DaveH
"Lee J Cook" <lee.cook (AT) kwikhols (DOT) co.uk> wrote
| Quote: | Dave,
Thanks for the reply i have found the Tzip component, could u give me a
code
example of how you set it up to work in your ISAPI,
thanks again
Lee
"Dave Hackett" <dave.hackett (AT) ns (DOT) sympatico.com> wrote in message
news:3fde54dd$1 (AT) newsgroups (DOT) borland.com...
Google for a Delphi component called TZip. It's a wrapper for the free
Zip.dll and UnZip.dll. I've successfully used these inside an ISAPI.
EXCEPT
under the new MS Server 2003. Grrr.
DaveH
"Lee J Cook" <lee.cook (AT) kwikhols (DOT) co.uk> wrote in message
news:3fddde78 (AT) newsgroups (DOT) borland.com...
Hi
I have a simple CGI application and I was wondering if there was a way
of
letting my application decompress a .zip file on the server?
Any help please
regards
Lee
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|