Can i have digital files outside var/downloads/ ?


I’m currently testing out some stores including CS-Cart and it’s looking pretty good so far…

I was wondering however if I can choose to not have all my digital download files stored in the var/downloads/ folder?

rather than them being in :


I would prefer them to be a few more directories up (and behind the web) to make it more secure such as :


I realise that I can use the product import to specify the download folder. So would this work if I was to do this?

Thanks in advance :)


You should be able to.

Create the desired directory (secure).

In init.php find:

define('DIR_DATABASE', DIR_ROOT . VAR_PATH . '/var/downloads/');

And change it to:

define('DIR_DOWNLOADS', '/myhosting/username/secure/');

This has worked in previous versions but I can't make it work in 2.2.1 and it might be a server issue.

Would you please try it and see if you can upload files for downloadable products?

When I upload I get errors.



Note that any file you reference in the system (Local, Web Server, etc.) will be copied to the var/downloads tree. The cart will not maintain the reference outside of the site.

Opinion: Changing ROOT_DIR is very dangerous and if you don't know all of what you're doing in the cart, it is a very bad idea. It will especially bite you if you are using SEO names.