Skip to content

Commit

Permalink
Fixed issue #5538: Further file uploads may fail after first upload p…
Browse files Browse the repository at this point in the history
…rocessed following Next/Prev question group - patch by litotes

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_ci@11297 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Oct 28, 2011
1 parent a6aaec8 commit 31c22f2
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions application/libraries/Save.php
Expand Up @@ -532,15 +532,19 @@ function createinsertquery($surveyid, $move, $thissurvey, $thisstep, $postedfiel
// move the files from tmp to the files folder

$tmp = $CI->config->item('tempdir').'/upload/';
if (!is_null($phparray) && count($phparray) > 0 && file_exists($tmp.$phparray[0]->filename))
if (!is_null($phparray) && count($phparray) > 0)
{

// Move the (unmoved, temp) files from temp to files directory.
// Check all possible file uploads
for ($i = 0; $i < count($phparray); $i++)
{
$sDestinationFileName='fu_'.sRandomChars(15);
if (!rename($tmp . $phparray[$i]->filename, $target . $sDestinationFileName))
echo "Error moving file to its destination";
$phparray[$i]->filename=$sDestinationFileName;
if (file_exists($tmp.$phparray[$i]->filename))
{
$sDestinationFileName='fu_'.sRandomChars(15);
if (!rename($tmp . $phparray[$i]->filename, $target . $sDestinationFileName))
echo "Error moving file to its destination";
$phparray[$i]->filename=$sDestinationFileName;
}
}
$_SESSION[$value] = json_encode($phparray);
}
Expand Down

0 comments on commit 31c22f2

Please sign in to comment.