Hi,

i am writing my own cck field. I am stuck with the following problem:
I want to save the files outside the www root folder so i want to alter the file path and set a custom oath (/var/files). Any tips if that is possible?
Thank you.

Comments

KarenS’s picture

Project: Content Construction Kit (CCK) » FileField
Version: 6.x-2.6 » 6.x-3.x-dev
Component: General » Code

CCK does nothing with files. Maybe you want to ask in filefield.

quicksketch’s picture

This is not possible generally speaking. You could make a symlink on your server from a directory within the files directory to another location though, then lock it down through .htaccess. However Drupal will have a hard time trying to display the files if they're not accessible under the files directory. Private downloads may also accomplish what you want, but I generally discourage their use because enabling private files has severe performance penalties.

marcoka’s picture

Not possible is bad, because as you said private files has a performance issues. In my case i display 90 Thumbnails and that will be a bootstrap overkill with private.
I thought about the htaccess method and read a lot of posts on drupal.org about it. One problem with that is an imagecache bug that makes the pictures accessibe over non clean urls like ?q=/mypath/foo/image.jpg, even if you use a RewriteRule.

Thats why i wanted to make my own private cck field, my own small private imagecache with selective access permissions (so i can save all thumbs in public, causing no bootstraps) and route all other images through a custom accesscheck.php to make it high-performance.

But if thats not possible i can crush this conceptual idea.

Thank you for the infos.

marcoka’s picture

Ok it its possible. Today i hacked the upload module for testing purposes.
If you load global $conf and the set file_downloads, file_directory_path on your path its working. Disadvantage is that you need to rewrite the whole thing/output etc on these paths because drupal will still get sites/default/files and look for the file there. Another disadvantage is that every module working with uploads, wont work anymore.

quicksketch’s picture

Status: Active » Fixed

I suggest giving http://drupal.org/project/filefield_private a shot. Otherwise I think this is generally out of scope for FileField, since it's mostly a server configuration problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

marcoka’s picture

Status: Closed (fixed) » Fixed

thanks quicksketch.
i already took a look into the code of filefield_private. thats were i got the idea from with modifying global $conf.
i took a different way now, forked imagecache with some pacthes postet in the issue queue by EugenMayer, secured the whole filefield folder with an .htaccess and wrote an imagecache protection module based on these patches. now i can protect every image i want, make it private without using the slow private mode

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.