Hi there.
My goal is to make a Webserver which can handle virtual files. (Im using Indy's TIdHTTPServer).
This is the virtual filetable:
AF343BA23F - File1.zip
FBE323FBA2 - File2.zip
CFADE12167 - File3.zip
When the client asks for one of this three files (like this: it should be asked to save the file File1.zip. Instead, my webserver sends the filename AF343BA23F.zip to the client.
How do I change the filename I am sending to the client?
This is a Very simplified code example:
The client is asked to save the file "AF343BA23F.zip". I want the client to be asked to save the file "File1.zip"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
My goal is to make a Webserver which can handle virtual files. (Im using Indy's TIdHTTPServer).
This is the virtual filetable:
AF343BA23F - File1.zip
FBE323FBA2 - File2.zip
CFADE12167 - File3.zip
When the client asks for one of this three files (like this: it should be asked to save the file File1.zip. Instead, my webserver sends the filename AF343BA23F.zip to the client.
How do I change the filename I am sending to the client?
This is a Very simplified code example:
Code:
procedure TForm1.IdHTTPServer1CommandGet(AThread: TIdPeerThread;
ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
LocalDoc: String;
ByteSent: Cardinal;
begin
if ARequestInfo.Document = '/AF343BA23F' then
LocalDoc := 'C:\File1.zip'
else if ARequestInfo.Document = '/FBE323FBA2' then
LocalDoc := 'C:\File2.zip'
else if ARequestInfo.Document = '/CFADE12167' then
LocalDoc := 'C:\File3.zip';
if FileExists(LocalDoc) then
ByteSent := IdHTTPServer1.ServeFile(AThread, AResponseInfo, LocalDoc);
end;
The client is asked to save the file "AF343BA23F.zip". I want the client to be asked to save the file "File1.zip"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.