如何激活powermail中的随机文件名

时间:2018-01-19 12:10:05

标签: random typo3 powermail

我有一个用户可以上传文件的表单。他们可以上传3个文件,每个文件都需要有一个唯一的名称。因此,即使这个人每次在电子邮件中输入不同的名称都会上传相同的文件,我从表单中获取。

所以我尝试使用randomizeFileName。 https://github.com/einpraegsam/powermail/blob/develop/Configuration/TypoScript/Main/setup.txt#L538

因为我的constants.txt中没有randomizeFilename,所以尝试在我的setup.txt中输入真值。

struct task
{
    char title[MAX]; // Eg. Assignment ,Exam,Test
    int weight; // Weightage of the task
    int fullmark; // Upon
    float mark; // Obtained marks
};

struct Subject
 {
    char subCode[MAX]; // CSCI103 MATH STAT
    char subTitle[MAX]; // Full title of subject
    int noTask; // No. of task for following struct
    task Task[MAX]; // Array of tasks
    float finalMark; // Final overall mark for subject
    Grade finalGrade; // Grade for subject
 };

int main()
{
    fstream afile;

afile.open ("test.dat", ios::in | ios::binary | ios::app);

int totalWeight = 0;
Subject S;

if(!afile)
    {
        cout << "Error opening file,please check" << endl;
        exit(1);
    }

cout << "------------------" << endl
    << "Subject adding system" << endl
    << "------------------" << endl << endl;

cout << "Subject Code: ";
cin >> S.subCode;
cin.clear();
cin.ignore(100,'\n');

cout << "Subject Name: ";
cin.getline (S.subTitle, MAX);

cout << "No of assessment tasks: ";
cin >> S.noTask;
cin.clear();
cin.ignore(100,'\n');

cout << endl;

// Loop for binary file
for(int i = 1;i<=S.noTask;i++)
{
    cout << "Task " << i << " Information" << endl
        << "\t Title: ";
    cin >> S.Task[i].title;
    cin.clear();
    cin.ignore(100,'\n');

    cout << "\t Weight: ";
    cin >> S.Task[i].weight;
    cin.clear();
    cin.ignore(100,'\n');

    cout << "\t Upon: ";
    cin >> S.Task[i].fullmark;
    cin.clear();
    cin.ignore(100,'\n');

    totalWeight +=S.Task[i].weight;
}

cout << endl << "Subject " << S.subTitle << " added to system" << endl
    << "Total weight = " << totalWeight << endl;

afile.write (reinterpret_cast <const char*>(&S), sizeof (S));

afile.close();

但遗憾的是,这不行。文件issue-1.pdf仍然具有相同的名称(+后缀因为我试了很多次)

enter image description here

我希望有人可以帮助我。非常感谢你!

1 个答案:

答案 0 :(得分:0)

根据扩展程序中包含的安装文件,Powermail 5.x的正确语法为:

plugin.tx_powermail.settings.misc.file.randomizeFileName = 1

在上面发布的截图中,文件部分缺失。

相关问题