Eurekalog“HTTP上传”:如何发送程序名称?

In several Delphi XE2 projects, I have set up Eurekalog to send bug reports via "HTTP upload" which works well, as I use a PHP script to catch the bug report, save it in a directory and send it to me via email:

<?php

require 'PHPMailerAutoload.php';

foreach ($_FILES as $key => $value)
{
    $uploaded_file = $_FILES[$key]['tmp_name'];
    $server_dir = 'upload/';
    $server_file = $server_dir . date("Y-m-d H-i-s ") . basename($_FILES[$key]['name']);
    $ext = strtoupper(pathinfo($server_file, PATHINFO_EXTENSION));
    if ($ext != 'EL')
    {
        continue;
    }
    if (move_uploaded_file($uploaded_file, $server_file))
    {
        echo '<html>';
        echo '<head>';
        echo '<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8">';
        echo '<title>Bug submission</title>';
        echo '</head>';
        echo '<body>';
        echo 'Thank you!<br />';
        echo "<!--
";
        echo "<EurekaLogReply>Thank you for your feedback!</EurekaLogReply>
";        
        echo "-->";
        echo '</body>';
        echo '</html>';

        SendBugReportMessage('auserofmyprogram@usersofmyprogram.com',
                             'A User of my program',
                             'Eurekalog Bug Report',
                             'This is a bug report from Eurekalog.',
                             'eurekalog.bugreport@mysite.com',
                             $server_file,
                             basename($server_file)
                             );
    }    
}

function SendBugReportMessage($AFrom, $AFromName, $ASubject, $ABodyText, $ARecipient, $AFileToAttach, $ANameOfFile)
{
    $email = new PHPMailer();
    $email->From      = $AFrom;
    $email->FromName  = $AFromName;
    $email->Subject   = $ASubject;
    $email->Body      = $ABodyText;
    $email->AddAddress($ARecipient);
    $file_to_attach = $AFileToAttach;
    $email->AddAttachment($file_to_attach, $ANameOfFile);
    return $email->Send();
}

?>

Now I have several programs using this very same PHP script to upload their bug reports. However, the bug report sent to this PHP script has always the name "BugReport". So, in the PHP script how can I get the name of the program which sent the bug report, so I can save it by attaching the program name and include the program name in the mail subject? Or could there be a solution by implementing something on the side of the Delphi code? Or in Eurekalog?

Eurekalog version is 7.1.0.0

You can use web-fields for that. EurekaLog has OnCustomWebFieldsRequest event handler, which allow you to alter web-fields for any web-based send method (such as HTTP upload, bug trackers with HTTP API, etc.).

Assign such event hanlder:

uses
  EEvents;

procedure AddApplicationName(const ACustom: Pointer; ASender: TObject { TELWebSender }; AWebFields: TStrings; var ACallNextHandler: Boolean);
begin
  AWebFields.Values['Application'] := AnsiLowerCase(ExtractFileName(ParamStr(0)));
end;

initialization
  RegisterEventCustomWebFieldsRequest(nil, AddApplicationName);
end.

Then, you can access your new "Application" field from your script. For PHP it will be $_REQUEST["Application"] or $_POST["Application"]

For this particular task you can also use OnCustomFileName event handler to alter file name used for sending. You are interested in AFileType = ftZIP (if you are going to send packed .elp report) or AFileType = ftBugReport (if you are going to send unpacked .el report).