Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Import Survey Issue - Version 2.55.1

  • gbasterra
  • gbasterra's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #143859 by gbasterra
Import Survey Issue - Version 2.55.1 was created by gbasterra
Hi, not sure if someone else are having this same issue. Already checked a lot of pages but didn't find something like this.

I exported a survey in a .csv file. When I try to reimport it (in an empty survey) I've got a blank page. After reading I found I can debug so I switched the debug option in config.pgp to debug=>1 and i get the following

PHP warning

fopen(): Filename cannot be empty

C:\surveys\limesurvey\limesurvey\application\helpers\admin\import_helper.php(1753)

1741 if(!isset($aOptions)){$aOptions=false;} // By default don't change finalized part
1742 if(!isset($aOptions) || !$aOptions){$aOptions="utf8";}
1743 if(!isset($aOptions)){$aOptions="\t";}
1744 if(!isset($aOptions)){$aOptions="\"";}
1745 // Fix some part
1746 if (!array_key_exists($aOptions, aEncodingsArray())) {
1747 $aOptions="utf8";
1748 }
1749
1750 // Prepare an array of sentence for result
1751 $CSVImportResult=array();
1752 // Read the file
1753 $handle = fopen($sFullFilePath, "r"); // Need to be adapted for Mac ? in options ?
1754 while (!feof($handle))
1755 {
1756 $buffer = fgets($handle); //To allow for very long lines . Another option is fgetcsv (0 to length), but need mb_convert_encoding
1757 $aFileResponses[] = mb_convert_encoding($buffer, "UTF-8", $aOptions);
1758 }
1759 // Close the file
1760 fclose($handle);
1761 if($aOptions){
1762 array_shift($aFileResponses);
1763 }
1764
1765 $aRealFieldNames = Yii::app()->db->getSchema()->getTable(SurveyDynamic::model($iSurveyId)->tableName())->getColumnNames();

Stack Trace
#0

C:\surveys\limesurvey\limesurvey\application\helpers\admin\import_helper.php(1753): fopen("", "r")

1748 }
1749
1750 // Prepare an array of sentence for result
1751 $CSVImportResult=array();
1752 // Read the file
1753 $handle = fopen($sFullFilePath, "r"); // Need to be adapted for Mac ? in options ?
1754 while (!feof($handle))
1755 {
1756 $buffer = fgets($handle); //To allow for very long lines . Another option is fgetcsv (0 to length), but need mb_convert_encoding
1757 $aFileResponses[] = mb_convert_encoding($buffer, "UTF-8", $aOptions);
1758 }

#1

C:\surveys\limesurvey\limesurvey\application\controllers\admin\dataentry.php(156): CSVImportResponses(null, "374973", array("bDeleteFistLine" => true, "sExistingId" => "ignore", "bNotFinalized" => false, "bForceImport" => false, ...))

151 }
152 $aOptions=(Yii::app()->request->getPost('notfinalized') == "notfinalized");
153 $aOptions=(Yii::app()->request->getPost('forceimport') == "forceimport");
154 $aOptions=Yii::app()->request->getPost('vvcharset');
155 $aOptions="\t";
156 $aResult=CSVImportResponses($filePath,$iSurveyId,$aOptions);
157 unlink($filePath); //delete the uploaded file
158 $aData="";
159 $aData=gT("Import a VV response data file");
160 $aData[]=gT("File upload succeeded.");
161 if(isset($aResult)){

#2

C:\surveys\limesurvey\limesurvey\application\controllers\admin\dataentry.php(99): dataentry->_handleFileUpload("374973", array("display" => array("menu_bars" => array("browse" => "Data entry")), "title_bar" => array("title" => "Data entry"), "sidemenu" => array("state" => false), "menu" => array("edition" => true, "import" => true, "close" => true), ...))

094 {
095 $this->_showUploadForm($this->_getEncodingsArray(), $iSurveyId, $aData);
096 }
097 else
098 {
099 $this->_handleFileUpload($iSurveyId, $aData);
100 }
101 }
102 else
103 {
104 Yii::app()->session = gT("This survey is not active. You must activate the survey before attempting to import a VVexport file.");

#3
unknown(0): dataentry->vvimport()
#4
+
C:\surveys\limesurvey\limesurvey\framework\web\actions\CAction.php(109): ReflectionMethod->invokeArgs(dataentry, array())
#5
+
C:\surveys\limesurvey\limesurvey\application\core\Survey_Common_Action.php(101): CAction->runWithParamsInternal(dataentry, ReflectionMethod, array("surveyid" => "374973", "sa" => "vvimport", "iSurveyId" => "374973", "iSurveyID" => "374973"))
#6
+
C:\surveys\limesurvey\limesurvey\framework\web\CController.php(308): Survey_Common_Action->runWithParams(array("surveyid" => "374973", "sa" => "vvimport"))
#7
+
C:\surveys\limesurvey\limesurvey\framework\web\CController.php(286): CController->runAction(dataentry)
#8
+
C:\surveys\limesurvey\limesurvey\framework\web\CController.php(265): CController->runActionWithFilters(dataentry, array())
#9
+
C:\surveys\limesurvey\limesurvey\application\controllers\AdminController.php(177): CController->run("dataentry")
#10
+
C:\surveys\limesurvey\limesurvey\framework\web\CWebApplication.php(282): AdminController->run("dataentry")
#11
+
C:\surveys\limesurvey\limesurvey\framework\web\CWebApplication.php(141): CWebApplication->runController("admin/dataentry/sa/vvimport")
#12
+
C:\surveys\limesurvey\limesurvey\framework\base\CApplication.php(185): CWebApplication->processRequest()
#13
+
C:\surveys\limesurvey\limesurvey\index.php(214): CApplication->run()

Already checked modules and extensions in php.

Do you have any clue why php is not getting the file?

thanks in advance for your help
The topic has been locked.
  • gbasterra
  • gbasterra's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #143860 by gbasterra
Replied by gbasterra on topic Import Survey Issue - Version 2.55.1
Information to be added. As I found not all the time this happens. It seems something on the date which is affecting the upload.

attached the survey structure and the exported file i'm working with
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 5 months ago #143863 by holch
Replied by holch on topic Import Survey Issue - Version 2.55.1
I didn't look at the files. But did you work with the CSV in Excel? Excel is doing strange things to CSV files. You should use something else, like Libreoffice.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: gbasterra
The topic has been locked.
  • gbasterra
  • gbasterra's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 5 months ago #143900 by gbasterra
Replied by gbasterra on topic Import Survey Issue - Version 2.55.1
THanks Holch. Found the issue. Parameter upload_max_filesize in php.ini was 2M and file was bigger. Not sure why i didn't update it. I switched to 20M and now is running smoothly.

It seems fopen() is throwing this error when php limits the size of the file to open. A little bit misleading.

Hope this helps to others.

Best regards
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose