Skip to content

Commit

Permalink
Fixed Issue: user gets a "no valid session" error on testing a file u…
Browse files Browse the repository at this point in the history
…pload question in preview mode

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@9442 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Amit Shanker committed Nov 7, 2010
1 parent 45e96bc commit 6ad3bd2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion upload.php
Expand Up @@ -30,8 +30,16 @@
// If this is just a preview, don't save the file
if ($preview)
{
if ($size > $maxfilesize)
{
$return = array(
"success" => false,
"msg" => "Sorry, This file is too large. Only files upto ".$maxfilesize." KB are allowed"
);
echo json_encode($return);
}

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file))
else if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file))
{
$return = array(
"success" => true,
Expand All @@ -47,6 +55,15 @@
else
{ // if everything went fine and the file was uploaded successfuly,
// send the file related info back to the client
if ($size > $maxfilesize)
{
$return = array(
"success" => false,
"msg" => "Sorry, This file is too large. Only files upto ".$maxfilesize." KB are allowed"
);
echo json_encode($return);
}

if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file))
{
$return = array(
Expand Down
2 changes: 1 addition & 1 deletion uploader.php
Expand Up @@ -48,7 +48,7 @@
{
session_name("LimeSurveyRuntime-$surveyid");
}
session_set_cookie_params(0,$relativeurl.'/');
session_set_cookie_params(0,$relativeurl.'/admin/');
@session_start();

if (empty($_SESSION) || !isset($_SESSION['fieldname']))
Expand Down

0 comments on commit 6ad3bd2

Please sign in to comment.