Welcome to the LimeSurvey Community Forum

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

Template editor allowed files upload

  • Ben_V
  • Ben_V's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
8 years 1 month ago #130172 by Ben_V
Hi,

I want to upload CSV files via the template editor... Can someone tell me where to edit the list of allowed file extensions ? I'm unable to find it :(

Thanks.


Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 1 month ago - 8 years 1 month ago #130174 by tpartner
Replied by tpartner on topic Template editor allowed files upload
You can add something like this to the config array in application/config/config.php:
Code:
'allowedtemplateuploads' => 'gif,ico,jpg,png,css,js,map,json,eot,svg,ttf,woff,txt,md, csv'

So that whole file would look something like:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|    'connectionString' Hostname, database, port and database type for 
|     the connection. Driver example: mysql. Currently supported:
|                 mysql, pgsql, mssql, sqlite, oci
|    'username' The username used to connect to the database
|    'password' The password used to connect to the database
|    'tablePrefix' You can add an optional prefix, which will be added
|                 to the table name when using the Active Record class
|
*/
return array(
  'components' => array(
    'db' => array(
      'connectionString' => 'mysql:host=localhost;port=3306;dbname=limesurvey;',
      'emulatePrepare' => true,
      'username' => 'username',
      'password' => 'password',
      'charset' => 'utf8',
      'tablePrefix' => 'lime_',
    ),
 
    // Uncomment the following line if you need table-based sessions
    // 'session' => array (
      // 'class' => 'system.web.CDbHttpSession',
      // 'connectionID' => 'db',
      // 'sessionTableName' => '{{sessions}}',
    // ),
 
    'urlManager' => array(
      'urlFormat' => 'path',
      'rules' => require('routes.php'),
      'showScriptName' => true,
    ),
 
  ),
  // Use the following config variable to set modified optional settings copied from config-defaults.php
  'config'=>array(
  // debug: Set this to 1 if you are looking for errors. If you still get no errors after enabling this
  // then please check your error-logs - either in your hosting provider admin panel or in some /logs directory
  // on your webspace.
  // LimeSurvey developers: Set this to 2 to additionally display STRICT PHP error messages and get full access to standard templates
    'debug'=>0,
    'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2
    'allowedtemplateuploads' => 'gif,ico,jpg,png,css,js,map,json,eot,svg,ttf,woff,txt,md, csv'
  )
);
/* End of file config.php */
/* Location: ./application/config/config.php */

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 8 years 1 month ago by tpartner.
The following user(s) said Thank You: Ben_V
The topic has been locked.
  • Ben_V
  • Ben_V's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
8 years 1 month ago #130175 by Ben_V
OUPS! not very deeply hidden ... found around L85 in application/config/config-defaults
Code:
$config['allowedtemplateuploads'] = 'gif,ico,jpg,png,css,js,map,json,eot,svg,ttf,woff,txt,md';  // File types allowed to be uploaded in the templates section.

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose