See the discussion at http://moodle.org/mod/forum/discuss.php?d=170655
Hi everyone. I have set an assessment task for my students in a Moodle 2.0 wiki and we have the bizzarre problem that images uploaded and inserted into posts are dissappearing after several hours.
When a user uploads an image and/or video to the wiki moodle server said image is assigned a location on the server (eg. http://moodle.uni/draftfile.php/8707/user/draft/705008760/activboard300_20090625112013.jpg) such that the image can be displayed in the users post.
After an undefined period of time that asset is no longer linkable and will no longer display in the post. If you put in the address for the asset directly you will get a page with "Sorry, the requested file could not be found" (e.g. The link above).
When you look at a wiki post where this has happened there will be no images in the post and/or a broken image icon (depends on how the browser handles it), but going into edit clearly shows the img tags and references to the missing image.
Please note that a 10min test is unlikely to make this issue apparent as there appears to be some undefined period of time, or unknown trigger before the uploaded assets become dead. Create a wiki post with some uploaded images and leave a day and the issue may become apparent, or maybe there is a trigger such that the more images others upload the quicker your assets are dropped from the server. I can only speculate, but hopefully someone expert in the moodle wiki can resolve.
Please advise ASAP.
SAM Marshall responded on the discussion board:
I don't know anything about Moodle 2 wiki. That said, I do know a bit about the file API, and draft file URLs should not be used except while you are editing content (such as a wiki page). Once the content has been saved, the version of the image that displays to users when not editing should have 'pluginfile.php' not 'draftfile.php'.
So if, when you use the html editor to add an image to a wiki page, after you save the page, the image on the resulting page still has the URL 'draftfile.php', then imo this is almost certainly a bug in the wiki which (after making sure it still occures in the latest release version, 2.0.2 or whatever) you should report in Moodle Tracker.
I believe the draft file areas, which are (when it's working) used only temporarily while editing, are deleted periodically in cron, which is probably what's causing your problem.