Well,
there is a way to do this.
But: Not in your university installation.
You need to have access to a server.
Then you do the following:
UL is the upload question
1. with two (hidden) questions of type equation extract the filename and the extension
eqFname:
{substr(UL,strpos(UL,'filename')+11,strpos(UL,'ext') - strpos(UL,'filename') -14)}
eqExt:
{substr(UL,strpos(UL,'ext')+6,3)}
2. In a question of type "short text" start an ajax-call to a small script that renames the file.
The ajax call may look like this:
Code:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
$.post('https://www.mafoserver.de/myFolder/renameFile.php' , { sid: "{SID}", fname:"{eqFname}", ext: "{eqExt}" },function(data) {
$('#question{QID} input[type="text"]').val(data)
});
});
</script>
You see, you call a small php script that is somewhere on your server and you post
- the surveyID
- the filename
- the extension
Now the php script
Something like this:
Code:
<?php
$ssid = $_POST["sid"];
$sfname = $_POST["fname"];
$sExt = $_POST["ext"];
$sfullname = '../limesurvey/upload/surveys/'.$ssid.'/files/'.$sfname;
$sNewName=$sfullname.'.'.$sExt;
$x=rename($sfullname,$sNewName);
echo $sfname.'.'.$sExt;
?>
Now you have a valid filename in the "files" folder that you can call in a later question.
1. Upload
2. Extraction of filename and extension (only for information, usually hidden)
3. The result of the ajax-call (only for information, usually hidden)
4. The picture is displayed
To be able to download these uploaded files later from your responses you have to rename back again (at the end of the survey)
Joffm