Can't download files with Attachment module

marcius - January 12, 2007 - 00:23
Project:Attachment
Version:4.7.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I installed FileManager and Attachment modules.
I enabled both modules and their use with pages in public mode. I also disabled upload module.
I created a page and attached a few files: they currently show at the bottom of the node.

The link associated to the module is correct: http://www.mysite.com/system/files/active/0/filename.txt but when I click on it I get a Drupal "page not found" error.

So I started debugging the problem and I discovered that relative URLs beginning with "system/files" are handled by file_download function in file.inc. This looks for any module that implements a (module)_file_download function. If it can't find any, it returns the "page not found" error.

Unfortunately it seems that the only module that has such a function is the upload module that needs to be disabled in order to get attachment module to work. How is this possible?

I also tried the private mode and it works correctly because in this case the attachment relative URL begins with "filemanager" and so it's managed by filemanager module as expected.

#1

telcontar - September 14, 2007 - 09:00

If you use the "public" download method, files should not be handled by any function, but directly by the webserver.

hook_file_download() is implemented by upload.module (among others). I would guess that you set the download method to "private" under drupal admin/settings? I don't mean the filemanager settings but the drupal site-wide settings. I guess that would interfere with filemanager if filemanager was set to "public" and if it was using the default "files" directory.

So you should either try to set the drupal download method to "public" so as not to conflict with filemanager, or chose another path for filemanager to store files. Maybe this should be verified and added to the documentation.

 
 

Drupal is a registered trademark of Dries Buytaert.