AnsweredAssumed Answered

Problem importing csv when upload directory outside Sugar base directory

Question asked by Thomas O'Brien on Nov 15, 2018
Latest reply on Nov 26, 2018 by Thomas O'Brien


I'm experiencing an issue with Sugar 8.0 (and also with 8.0.1) and it's driving me crazy trying to figure out how to fix it.

We're looking to setup multiple Sugar instances on separate web servers. To enable this we want to store uploads on a shared file system.


To accomplish this we've changed the upload_dir in config.php to point to a separate drive. This works fine for uploads, and they can be seen and accessed from within Sugar with no issues.


But, we're having an issue with CSV imports. Whenever we try and import from CSV, we just end up with a blank screen in Sugar after uploading the CSV.


Checking the file system shows that the CSV was uploaded successfully, however we're getting the following error in the SugarCRM log:



Thu Nov 15 17:01:46 2018 [12064][1][FATAL] Exception in Controller: RuntimeException: File name violation: file outside basedir in /var/www/html/sugar/src/Util/Files/FileLoader.php:64
Stack trace:
#0 /var/www/html/sugar/modules/Import/sources/ImportFile.php(96): Sugarcrm\Sugarcrm\Util\Files\FileLoader::validateFilePath('/mnt/efs/sugar/...')
#1 /var/www/html/sugar/modules/Import/views/view.confirm.php(97): ImportFile->__construct('upload://IMPORT...', ',', '', false)
#2 /var/www/html/sugar/include/MVC/View/SugarView.php(152): ImportViewConfirm->display(Array)
#3 /var/www/html/sugar/include/MVC/Controller/SugarController.php(351): SugarView->process(Array)
#4 /var/www/html/sugar/include/MVC/Controller/SugarController.php(299): SugarController->processView()
#5 /var/www/html/sugar/include/MVC/SugarApplication.php(198): SugarController->execute()
#6 /var/www/html/sugar/index.php(27): SugarApplication->execute()
#7 {main}


I cannot work out how to fix this, and also can't find any documentation on anybody experiencing the same issue. I've tried various different folders and test, but as soon as I point the uploads to outside the Sugar base directory, import from CSV doesn't work.


Upload folder permissions are correct as far as I can see and folder is owned by www-data


Help would be greatly appreciated, this is a big impediment for us at the moment.


Setup as below:

Ubuntu 16.04

Apache 2

PHP 7.1

Sugar 8.0