Skip to content

Commit

Permalink
Fixed issue #6008: File upload doesn't work from data entry, not avai…
Browse files Browse the repository at this point in the history
…lable in response edit

dev: in yii branch creation of upload directory didn't work other than that data entry file upload works fine
  • Loading branch information
mennodekker committed May 1, 2012
1 parent 134812e commit f84f4db
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions application/helpers/admin/activate_helper.php
Expand Up @@ -481,21 +481,19 @@ function activateSurvey($surveyid, $simulate = false)
$activateoutput .= "<div class='successheader'>".$clang->gT("Survey has been activated. Results table has been successfully created.")."</div><br /><br />\n";

// create the survey directory where the uploaded files can be saved
if ($createsurveydirectory)
if (!file_exists(Yii::app()->getConfig('rootdir')."upload/surveys/" . $surveyid . "/files") && !(mkdir(Yii::app()->getConfig('rootdir')."upload/surveys/" . $surveyid . "/files", 0777, true)))
if (!file_exists(Yii::app()->getConfig('uploaddir')."/surveys/" . $surveyid . "/files"))
if ($createsurveydirectory)
{
if (!file_exists(Yii::app()->getConfig('uploaddir') . "/surveys/" . $surveyid . "/files"))
{
if (!(mkdir(Yii::app()->getConfig('uploaddir')."/surveys/" . $surveyid . "/files", 0777, true)))
{

$activateoutput .= "<div class='warningheader'>".
$clang->gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the /upload/surveys directory.") . "</div>";
}
else
{
file_put_contents(Yii::app()->getConfig('uploaddir')."/surveys/" . $surveyid . "/files/index.html",'<html><head></head><body></body></html>');
}
if (!(mkdir(Yii::app()->getConfig('uploaddir') . "/surveys/" . $surveyid . "/files", 0777, true)))
{
$activateoutput .= "<div class='warningheader'>" .
$clang->gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the /upload/surveys directory.") . "</div>";
} else {
file_put_contents(Yii::app()->getConfig('uploaddir') . "/surveys/" . $surveyid . "/files/index.html", '<html><head></head><body></body></html>');
}
}
}
$acquery = "UPDATE {{surveys}} SET active='Y' WHERE sid=".$surveyid;
$acresult = Yii::app()->db->createCommand($acquery)->query();

Expand Down

0 comments on commit f84f4db

Please sign in to comment.