How to access Support Files

How to access Support Files

by Thelma Looms -
Number of replies: 4

Hello Richard,

I am new to CodeRunner and am inquiring how to access Support Files.  This is  an HTML/CSS/JS course and  programs require access to external files.  The Help states that files are added to the working directory.   Are there any examples of how this is used?

Thanks.

In reply to Thelma Looms

Re: How to access Support Files

by Richard Lobb -

Hi Thelma

I'm not sure what you mean by "requiring access to external files" in the context of an HTML/js/css course. If you're using a procedural language like Python or C, you can provide students with a data file by uploading it into the question using the Support files section of the authoring form. The student's answer code can then open the file and read it with code like

infile = open('<name_of_support_file', 'r')
data = infile.read()

(depending on the language, of course).

In an HTML/js/css course, however, this style of file processing isn't usually possible and I'm not sure what type of 'external file' you wish to access. Could you give me an example of a simple question you would like to write that uses such an external file, please, and I'll see if I can come up with a solution?

Cheers

Richard

In reply to Richard Lobb

Re: How to access Support Files

by Thelma Looms -

Hello Richard,

Thanks for your response. 

I have been following your answers to the group on using HTML/CSS/JavaScript in CodeRunner and have a small working prototype.   I've uploaded an image file into the Support Files area and would like students to include the image using the <image> tag.  

Thank you.

In reply to Thelma Looms

Re: How to access Support Files

by Richard Lobb -

Hi Thelma

Sorry, but what you're trying to achieve isn't possible. The src attribute of an <img> element is a URL. With the question type you're using (if I understand correctly) the student is editing the HTML of the question on their own machine prior to submission, and watching the rendered result. For this to work, the src attribute must be the URL of an existing image resource on the web so the browser can load it dynamically with an HTTP request.

The files you place in the Support Files area of the question are uploaded to the Jobe server when the question is graded - they're not relevant while the student is editing their question.

I suggest you give students the URL of some existing image on the web you'd like the student to display.

Richard

In reply to Richard Lobb

Re: How to access Support Files

by Thelma Looms -

Hello Richard,

Thanks for the feedback!

Best,

Thelma