Resource types

Obtaining the complete URL of an activity-nested file

 
Picture of Philippe Decloitre
Obtaining the complete URL of an activity-nested file
 

Hello,

Is it possible to obtain the complete URL of a file that is burried wihtin a folder belonging to an activity such as SCORM or HotPot or or a mini-site uploaded in "File" resources on Moodle?

Thank you.

 
Average of ratings: -
Picture of Gordon Bateson
Re: Obtaining the complete URL of an activity-nested file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Moodle would only allow access to the image files in a HotPot to Moodle users who are normally allowed access to that HotPot. As a result, this is not recommended as a generic way to share files in Moodle. A better way to share files, is to use a repository. However in some cases, for example sharing images among HotPots in the same course, the method you are attempting may be reasonable.

The easiest way to find out the URL would be to create a Hot Potatoes exercise that includes an image, then add that to Moodle as a HotPot activity and see what the URL of the image is when it is displayed in the browser.

Probably, the URL looks some things like this?

"9999" is the contextid of the HotPot activity, and "PATH/TO/IMAGE/FILE.gif" is the relative path to the image file within the HotPot's file area.

The contextid is not easy to determine without access to the database, but it does appear in some URLs, such as image URLs, if you know where to look.


 
Average of ratings: -
Picture of Philippe Decloitre
Re: Obtaining the complete URL of an activity-nested file
 

Thank you for your nice and as always complete answer Gordon!

I will try it out and come back with feedback.

Have a nice day. smile

 
Average of ratings: -