How to download (or rename) student assignment that has been uploaded with special characters in the filename

How to download (or rename) student assignment that has been uploaded with special characters in the filename

by Angela Leavens -
Number of replies: 1

Hello,

I have a lecturer who needs to mark their assignments, but the student has uploaded the word doc with a special character in the filename.  As such the usual 'Sorry the requested file could not be found' error message has appeared; Error code: Filenotfound.  Can they be downloaded? Is there anyway for me to rename the students document so the lecturer can open it?  I have tried different browsers, right mouse clicking, save as - to no avail; is there somewhere in the Admin menu I can see the students documents they have uploaded?  

FYI - The deadline for the assignment has passed and this is Uni level, so grade penalties will apply.  Which is why asking the student to re-upload isn't desirable.

Your thoughts would be appreciated.

Thanks

Average of ratings: -
In reply to Angela Leavens

Re: How to download (or rename) student assignment that has been uploaded with special characters in the filename

by Ken Task -
Picture of Particularly helpful Moodlers

Interesting ... but not really surprising ... students with some technical understanding sometimes like to 'mess with the system' ... but then again ... might really be un-intentional.   Anyhoo ... the possible answer involves DB and locating the file in the sea of files uploaded to moodle in moodledata/filedir/.

select userid,contenthash,filename,filearea,filesize from mdl_files where filename like '%.docx' and filearea = 'submission_files' and userid = '9492';

where the userid is the id number of the student.


Hopefully, you will see something like this:

+--------+------------------------------------------+-----------------------------------------+------------------+----------+
| userid | contenthash                              | filename                                | filearea         | filesize |
+--------+------------------------------------------+-----------------------------------------+------------------+----------+
|   9492 | 5883f23f43b5a29ca37ad66d02986b501d9dc655 | Reflection on Technical Writing #2.docx | submission_files |     7644 |
+--------+------------------------------------------+-----------------------------------------+------------------+----------+
1 row in set (0.00 sec)

First, think I'd check out the file itself.  Using example above:

Found in moodledata/filedir/58/83/ a file by the name of
5883f23f43b5a29ca37ad66d02986b501d9dc655

I would copy the 5883f23f43b5a29ca37ad66d02986b501d9dc655 file out to some other location and rename it on the fly ...
from moodledata/filedir/58/83/
cp 5883f23f43b5a29ca37ad66d02986b501d9dc655 /sometest/dir/test.docx

Scan test.docx

OR inspect it's contents ...

mv test.docx test.zip
unzip test.zip

A .docx is really a zip, BTW.

Just to see if there is anything else 'funny' contained in the doc.

If it's clean, use whatever tool you have to change the
filename column of that row (above) to a filename that doesn't contain any
'special characters' in it.

Then go back to Moodle interface to see if it shows with your change and
can be downloaded.

'spirit of sharing', Ken