Uploaded Images Dissappearing From Wiki after several hours

Uploaded Images Dissappearing From Wiki after several hours

by Matt Bower -
Number of replies: 14

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.

Best wishes,

Matt Bower

 

Average of ratings: -
In reply to Matt Bower

Re: Uploaded Images Dissappearing From Wiki after several hours

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi,

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.

--sam

Average of ratings: Useful (3)
In reply to sam marshall

Re: Uploaded Images Dissappearing From Wiki after several hours

by Ludo (Marc Alier) -
Looking into it. Thanks for the advice Sam.
In reply to Ludo (Marc Alier)

Re: Uploaded Images Dissappearing From Wiki after several hours

by Ian Miller -

we’re having the same issue.

the same thing happens in the question-db.  --> another thread, same issue: http://moodle.org/mod/forum/discuss.php?d=185839

it’s pretty weird. the images dissapear, but i can’t reproduce this.

(same like here: http://tracker.moodle.org/browse/MDL-26782 )

i’ll try 2 reproduce the issue. if i’ll be able, l’ll reopen the bug in the tracker...

 

 

In reply to Ian Miller

Re: Uploaded Images Dissappearing From Wiki after several hours

by Ian Miller -

i was able 2 reproduce the issue:

the error appears in every section, where u handle images.

the user, which has uploaded the image (this is also the user, which has created the wiki/question/whatever) _can always_ access the picture .

all other users _can not_ access the picture, while its a ‘draftfile.php’ url.

all other users _car_ access the picture, when the url changes to a ‘pluginfile.php’ url.

 

So the question for me is: When does/should Moodle convert/change the url from ’draftfile.php‘ to ‘pluginfile.php’? I made 3 questions yesterday. one question (only the pictures in there wink ) has a pluginfile.php url (and there, everything works fine). the othters still has the draftfile.php url. there the pictures just are shown, when u are logged in as the user, which has created the question (und has uploaded the picture).

 

There might be an issue changing the urls. Do you agree?

Average of ratings: Useful (1)
In reply to Ian Miller

Re: Uploaded Images Dissappearing From Wiki after several hours

by Luis de Vasconcelos -

Ian,

Did you find an answer to your "when does/should Moodle convert/change the url from draftfile.php to pluginfile.php" question? If so, what was your finding?

In reply to Luis de Vasconcelos

Re: Uploaded Images Dissappearing From Wiki after several hours

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

I already gave that answer above in this thread. The draftfile.php URLs should be removed as soon as you save an editing form.

For example, if I put an image  in this forum post, it will have a draftfile.php URL only while I am editing the forum post. As soon as I hit 'Post to forum' and the actual post contents are saved to the database, there should be no reference any more to draftfile.php.

--sam

In reply to sam marshall

Re: Uploaded Images Dissappearing From Wiki after several hours

by Rick Bruderick -

Maybe I'm in the wrong thread, but I'm experiencing the same problems - and worse - when adding images to questions.  Before saving the question, the image shows a link such as:  

img src="http://moodle.chzh.cn/draftfile.php/120/user/draft/466796875/tbl.jpg"

But after the question is saved, any attempt to display that question will produce an infinite loop that locks up Moodle in the browser.  I have to close and clear the browser before Moodle will work in it again.  This is a serious problem.

I didn't do the install, my IT team did.  They don't speak much English.  I don't speak much Chinese.  We've had this problem for a couple of months.  We're using:  $release  = '2.1.1+ (Build: 20110803)';

What can we do to fix this?

In reply to sam marshall

Re: Uploaded Images Dissappearing From Wiki after several hours

by Thom Rawson -

Ok...  I've got a good example on this topic, I think.

I upload a Moodle 1.9 course which I'm intending to convert to 2.x.  The headings for each section have an image in them.  However, Moodle 2.x now has a "Topic Heading" section.  So I go into the topic heading editor and add a topic heading.  When I save, my image disappears.

I noticed that it has "draftfile.php" when I edit and also that the image disappears right when I go in to edit.  The image is stored in the legacy course files repository for this course due to the conversion but I can't insert it back into the topic easily.

Does this mean that a converted 1.9 course cannot be edited without having this kind of issue?

Average of ratings: Useful (1)
In reply to Matt Bower

Re: Uploaded Images Dissappearing From Wiki after several hours

by Sérgio Marcelo Paiva -

Hello,
For me it was enough to disable the filter "Convert URLs into links and images" in: Site Administration> Plugins> FILTERS> MANAGE FILTERS, and the images reappeared. See picture.

Attachment manage_filters.gif
In reply to Matt Bower

Re: Uploaded Images Dissappearing From Wiki after several hours

by John Provasnik -
Picture of Particularly helpful Moodlers Picture of Testers

Hi Matt. Being that there has been no resolution to this issue, I've created a tracker: https://tracker.moodle.org/browse/MDL-48371

In reply to John Provasnik

Re: Uploaded Images Dissappearing From Wiki after several hours

by Marianne Michel -

Hi John.


I'm registered on the moodle tracker site but I cannnot see the MDL-48371 ...

Any idea ?


Thx you in advance,
Marianne.


In reply to Marianne Michel

Re: Uploaded Images Dissappearing From Wiki after several hours

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

Re: Uploaded Images Dissappearing From Wiki after several hours

by David Dunn -

This is a different issue to the one being discussed here, IMO.

I have users reporting the same error as the OP: images inserted into wikis disappear. I'll try Sergio's suggestion and report back.