Developers' Forum

how to access attached files

how to access attached files

by Jim Newton -
Number of replies: 2

I am defining a question with a template grader.  I'm attaching some support files which the custom grader will want to use, and I'm allowing/requiring that the student attach exactly one file with his answer submission.   How can I access these files from the template grader?   I know apriori the names of the support files, but I don't know the name of the file the student will attach.


question about attached files

In reply to Jim Newton

Re: how to access attached files

by Richard Lobb -

Some of the finer details like this are documented within the on-line help. In this case, if you click the little Help icon by the Allow attachments field in the question authoring form you'll get told the following:

Whether to allow students to add attachments to their submissions and, if so, how many. Attachments are copied into the runtime working directory and a comma-separated list of the names of the attachments is provided  to the template in the Twig variable {{ ATTACHMENTS }}. Warning: allowing attachments could have performance or disk-space implications for the Moodle and Jobe servers with large classes and/or large attachments. The Moodle server, and Jobe servers prior to February 2019, store all attachments indefinitely.

In reply to Richard Lobb

Re: how to access attached files

by Jim Newton -

Thank you, that is useful information.

And if there are Support files, are they also copied to the runtime working directory?

support files