Skip to content

Commit

Permalink
Fixed issue #8768: Error when no csv file selected on CPDB import
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Feb 27, 2014
1 parent c221b6f commit a8cee05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion application/controllers/admin/participantsaction.php
Expand Up @@ -1083,9 +1083,13 @@ function attributeMapCSV()
{

$clang = $this->getController()->lang;
if ($_FILES['the_file']['name']=='')
{
Yii::app()->setFlashMessage($clang->gT('Please select a file to import!'),'error');
Yii::app()->getController()->redirect(array('admin/participants/sa/importCSV'));
}
$sRandomFileName=randomChars(20);
$sFilePath = Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR . $sRandomFileName;

$aPathinfo = pathinfo($_FILES['the_file']['name']);
$sExtension = $aPathinfo['extension'];
if (strtolower($sExtension)=='csv')
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/participants/importCSV_view.php
Expand Up @@ -7,7 +7,7 @@
<label for="the_file" id="fileupload">
<?php $clang->eT("Choose the file to upload:"); ?>
</label>
<input type="file" name="the_file" />
<input type="file" name="the_file" required>
</li>
<li>
<label for="characterset" id="characterset">
Expand Down

0 comments on commit a8cee05

Please sign in to comment.