procedure TfrmMainUpFiler.brk_svrRequest(ASender: TObject; ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse);
var
VUpload: TBrookHTTPUpload;
VField: TBrookStringPair;
VFile, VFileList, VUsersList, VError: string;
begin
if ARequest.IsUploading then
begin
VFileList := '<ol>'; // This variable is to build a list of links of the uploaded files.
// You can ignore all lines with VFileList and VUsersList.
for VUpload in ARequest.Uploads do
begin
// I suspect there is a problem with VUpLoad.Field. In the original example, it contains "file1" and "file2" etc.
// But in my modified example, it always contains "file[]".
if VUpload.Save(False, VError) then
VFileList := Concat(VFileList, '<li><a href="?file=', VUpload.Name, '">',
VUpload.Name, '</a></li>')
else
VFileList := Concat(VFileList, '<li><font color="red">', VUpload.Name,
' - failed - ', VError, '</font></li>');
end;
VFileList := Concat(VFileList, '</ol>');
VUsersList := '<ol>';
for VField in ARequest.Fields do
VUsersList := Concat(VUsersList, '<li>', VField.Value, '</li>');
VUsersList := Concat(VUsersList, '</ol>');
AResponse.SendFmt(PAGE_DONE, [VFileList, VUsersList], CONTENT_TYPE, 200);
end;
end;