[LON-CAPA-users] Using Custom response

lon-capa-users@mail.lon-capa.org lon-capa-users@mail.lon-capa.org
Wed, 17 Oct 2007 19:50:41 -0400

OK, another hair-brained scheme going on here.

I would like to do the following: Have the student upload a file, then use
a customresponse tag to use code (perl, javascript, java, C++, standalone
Visual Basic program) to analyze the file and return the appropriate return
code. Typically I would expect to return something like EXACT_ANS or
INCORRECT. The student would then fix the file and resubmit it until it is

In the sample code for customresponse, the <customresponse> tag includes a
<textline />; the contents of the textline show up as the variable
$submission in the <answer> code.

I want to (in essence) replace the <textline> with an <essayresponse>,
where I get the functionality of the file upload process. Is customresponse
limited to textlines, or can I use other types of responses? Does anyone
have sample code that does non-textline uses of <customresponse>? I notice
that one of the available return codes from <customresponse> is
INVALID_FILETYPE, which leads me to hope the <answer> code should be able
to find the uploaded file:)

Hmmm, another potential problem: when the file is uploaded, I can retrieve
the url for the file on the LonCapa server. I assume the code would be able
to read the file from this url? For security, LonCapa perl has been
restricted to remove the file access functions - can javascript or other
languages access the file somehow?