Where are drag & drop images stored ?

Where are drag & drop images stored ?

by Frank Hassani -
Number of replies: 15

Hi,

i wanted to have a way to overview which images i already have stored in Moodle, from drag & drop, so i can for example re-use or update them, without necessarily knowing where and if in the courses they are used or still used.

When i examinded the html code of a drag & drop image i recognized its a function call like src="http://mymoodlesite.com/draftfile.php?file=/5/user/draft/15243280/Mdl_Clusters_01.jpg"

Question, where does this finally saves the images ? I wasn't able to find them back via FTP find function for the image names.


I saw there is a 60 page ultra lengthy thread about this, but i wasn't able to find an answer in this. Only thing i need to know is what the path is under the moodle installation.


Reards,

Frank

Average of ratings: -
In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The answer is complicated, and not at all helpful to you in achieving what you want to do (https://docs.moodle.org/dev/File_API_internals).

If you know in advance that you are likely to re-use a set of files, then from the start you can put them in your 'My private files' area https://docs.moodle.org/31/en/Private_files

There is no easy way to update all the files in a lot of questions.

Sorry there is not a better answer to this.

Average of ratings:Useful (1)
In reply to Tim Hunt

Re: Where are drag & drop images stored ?

by Frank Hassani -

Hi Tim,

thx for your reply. Yes i've checked over the database, there i find some cryptic hints that the images are "somewhere".


Q1: Are they stored within the db ?


Q2: Will the images still show when i export the course and import it on another Moodle install ?


Q3: Will the images still show if i change the hosting server of the Moodle install by copying the moodle app dir to another server ?



In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Q1) The files are stored on the server's disc, in the moodledata folder. However, the filenames are cryptic.

Q2) Yes, the images will be preserved if you backup and restore a Moodle course or activit, or export the questions as Moodle XML format, and re-import.

Q3) If you move your Moodle site to a new server, you need to follow the steps on https://docs.moodle.org/31/en/Moodle_migration. If you do, all will be well.

Average of ratings:Useful (1)
In reply to Tim Hunt

Re: Where are drag & drop images stored ?

by Frank Hassani -

Thank you Tim.


Are the images with cryptic names in a certain folder all spread over different ones ?

In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by Frank Hassani -

ups i mean 

... or all spread over different ones ?

In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have you looked in moodledata?

In reply to Tim Hunt

Re: Where are drag & drop images stored ?

by Frank Hassani -

ok i c now why i didn't find it then. Moodle is a one-click-install offered by the web-host, and the moodledata folder is installed outside the one-click-install dir, probably even outside my reach at all, since a full server search also didn't pull out search results.


Thx

In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I would be very surprised if you could not access your moodledata folder.  Some one click installs actually put inside the moodle folder or public html folder though this is not recommended.  
Average of ratings:Useful (1)
In reply to Emma Richardson

Re: Where are drag & drop images stored ?

by Frank Hassani -

thx Emma,

yes i remember i saw this once with another hoster, but here with 1&1 moodledata dir seems not findable. Have sent a request to their support.


In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Frank,

I have a 1and1, one-click install of Moodle just for testing, and as Emma mentioned, the moodledata folder is inside the moodle folder.

If you open your config.php file in your moodle folder, it will show you where everything is. Like mine (redacted):

$CFG->dataroot  = '/homepages/anumber/anothernumber/htdocs/moodlexx/moodledata';

From it you can see my moodledata folder is inside my moodle folder  which is moodlexx.

Average of ratings:Useful (1)
In reply to AL Rachels

Re: Where are drag & drop images stored ?

by Frank Hassani -

Thank you Al,

great, in the config.php it turned out that my folder was named "data" instead of "moodledata" ... no idea why.


In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Frank,

Glad you found it. Honestly, I can't remember if I named that data folder or not as I created that Moodle long enough ago that I have forgotten the install details. Maybe it just depends on how the actual 1and1 server has the one click install routine setup, and we're probably on different physical servers.

Your original post mentions you want to "have a way to overview which images i already have stored in Moodle." Your photo of the location of your data folder shows that you have not implemented a repository so I would recommend that you set one up. You can drag and drop files directly into the repository via ftp, etc. and then access and use them in Moodle via a Private Files block or a Folder resource. When you select a file from the repository via the Moodle File Picker, you can click the radio button for Create an alias/shortcut to the file. (needs to be enabled in the repository settings) When you use the photo's via an alias, if you change the original photo content of the file in the repository, but keep the name the same, it will automatically update the photo where ever you used it in Moodle.

Average of ratings:Useful (1)
In reply to AL Rachels

Re: Where are drag & drop images stored ?

by Frank Hassani -

Hi Al,

ok thx for info. So i then best make myself an intermediate library structure under admin, and link picture aliases for all courses i create to this lib.

Question is, if those images also be passed along on course export, and will they require the same admin lib folder structure for the importer, so the images can be exchanged by keeping the alias-link for the exported / imported course as well. That i'll test asap.

Regards,

Frank

In reply to Frank Hassani

Re: Where are drag & drop images stored ?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Frank,

If I remember correctly, alias files will backup and restore only on the site your created them on. Moodle will give a warning about it. It is still worthwhile to create and use the repository though. And, of course, when selecting a file with the file picker for use in your site, you don't have to use the alias setting, you can always select, Create a copy. That way if you do backup and export for another site, the files will transfer over.

One of the main things about using the repository is you can upload files to it from OUTSIDE of Moodle using various file transfer methods, such as ftp. You can even transfer zip files, and then unzip from inside Moodle. You can also transfer files that are larger than your Moodle file size setting.