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@11296 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Oct 28, 2011
1 parent 0bb3da3 commit be0f3f8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions save.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,16 +501,19 @@ function createinsertquery()
// move the files from tmp to the files folder

$tmp = $tempdir.'/upload/';
if (!is_null($phparray) && count($phparray) > 0 && file_exists($tmp.$phparray[0]->filename))
if (!is_null($phparray) && count($phparray) > 0)
{
// move files from temp to files directory

// 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 be0f3f8

Please sign in to comment.