I'm trying to sell files at a drupalcart store. Under Product Settings in the File Download Settings field I'm suppose to enter a directory outside my web root. Does anyone know how I can go about this?

The description fo the field is "The absolute path (or relative to Drupal root) where files used for file downloads are located. For security reasons, it is recommended to choose a path outside the web root."

Thanks in advance!

Comments

Scott M. Sanders’s picture

Example: If you have Drupal-Ubercart installed at www.mysite.com/shop, you can put downloads at /folder and refer with "../folder" (without quotes).

chamac45’s picture

I'm not quite sure I understand.

I access my site through filezilla and go into the public html folder. Are you saying the downloads folder should be create at that root? My store is in the modules folder. I can get to it by going to mysite.com/products but I don't have a products folder. Should I create the downloads folder under modules\ubercart?

StephenFresh’s picture

try creating a directory (eg called downloads) in the same level as your public directory and give it correct permissions then use for example ../../../downloads

msalt’s picture

Same question, exactly. I think this is what you mean, but would like a confirmation. I'm going to overcommunicate for anyone else who gets confused as easily as I do.

So, as I understand it, your (relative) server root, in Filezilla, will be simply /. Your web root will be in that folder, something like "www" or "htdocs".
Most of your drupal configurations will be in the folder /www/sites/all.

This warning is saying not to have your download directory in the /www/ folder or any of its subfolders at all -- to make a different folder alongside /www (say, "downloads") and put it there.
So that when you look in filezilla, it will list
/
/www
/downloads
/other folders.

And since the path you enter in your File Download settings, at http://www.example.com/admin/store/settings/products/edit/features
is relative to your web root, you use the ../ to go up a level first, hence you would enter
../downloads

Is that correct?

kirtimansharma’s picture

Quite nicely asked by msalt. I m confused with the same problem.

cisliu’s picture

I found this tutorial which helped me to solve the problem. Its here:
http://www.torontowebsitedeveloper.com/drupal-video-tutorials/drupal-ube...

Basically, you create a folder called "download" (or whatever you like) in the public_html>shop or drupal (or wherever you installed your drupal core).

Also, I didn't put any "/" or ".." into the Files path field. I just put the folder's name there.

I'm not sure if this is the secure way to do it but its the only way so far that worked for me.

Hope this help clarifying issues. However, if anyone finds a secure way to do it, i.e. create the file download folder outside of the web root and make the files path working, please share. Thank you!

bolver’s picture

I was having the same problem identifying the correct folder for downloads. This explained the process very simply and solved my issue. Thanks!

Mugé’s picture

Although this post is 4 years old, I could not find a resolution, so I am going to post what worked for me, in case, someone has same issue.

Drupal version 7.

My mistake in entering the product path in www.mywebsite%.com/shop/admin/store/products/view, 'File Download Settings' was I started typing with the folder name where my Drupal is installed such as 'shop/sites/default/' and then whatever the path is for your 'products' folder.

Just a side note:
I created a 'private' folder such as 'shop/sites/default/private' that has a security .htaccess file preventing the folder from being accessed as it will have e-commerce download files.

My resolution to the path:
Do NOT use the folder (directory) name you have your Drupal installed. Mine is 'shop'. So I left out shop and added my path to products folder as follows:

'sites/default/private/products'.

debonair47’s picture

I have been scratching my head over this, for the last 3 days trying different things. This has half done it for me.
All i need to do now is know how to make a .htaccess security with my download file in the path??
I will appreciate any ideas?
I have this on Shared hosting with godaddy . Cheers