Hi,
I have set up a CCK field to upload files to a private directory as described at http://drupal.org/node/826330 but can't get it to work properly.
- I have a page, with a user login block, call it Page A.
- After logging in successfully, it gets redirected to a members only welcome page, using the login destination module (call it Page B). The welcome members-only page includes the private file CCK field and a file has been successfully uploaded into the private files directory. There is a link to that file on the welcome page.
- When I open a new browser session (e.g. in Firefox) and log in using Page A, it is successful and redirects to Page B.
- When I try clicking on the link to the private file on Page B, I get "Access denied:
You are not authorized to access this page."
- When I go back to "Page A", the user login form appears again, which shows that I am logged out. I don't know why this is the case.
- I log in again, get redirected to Page B, and then try clicking on the link to the private file and it works as expected.
Thus, when opening a new session, the private download link does not work...somehow, I am logged out after the "access denied". On subsequent attempts within the same session, it works.
Has anybody experienced this issue? Any suggestions on solving the issue or ideas on what the issue could be? (I already check the user role permissions, private members only page permissions, rebuilt permissions & cleared the cache through Drupal and the browser, but the issue still persists.) Is this a bug? Thank you in advance for any help you can provide--much appreciated.
Comments
Comment #1
new_B commented*Note: I am just using CCK field for the file upload. I did not use FileField Paths as described in the tutorial.
Comment #2
johnhanley commentedI can't think of anything off the top of my head. You already mentioned all the most obvious causes. The module works as advertised for most configurations. Can you think of any other modules that might be causing a conflict?
Comment #3
new_B commentedThanks for the quick response & suggestion, Bacteria Man.
I also have Content Access module installed and checked the settings as well...the private page node type does give the user access permissions. I tried changing the Advanced settings for Node Priority but that didn't solve the issue either.
I checked the Permissions page and ensured that all access control is correct (i.e., for the Private Download module as well as the Upload Module). I even tried uninstalling the module, deleted the .htaccess file and reinstalled & configured it but the issue persists.
I don't believe that any other modules could be causing the issue.
Comment #4
new_B commentedDoes anybody have any ideas/suggestions for finding the cause of the issue? (I still can't get it to work.)
Thanks for any tips you can provide.
Comment #5
johnhanley commentedYou might try setting up a separate installation and configure Private Download all by itself. That way you'll confirm the module is working correctly in your server environment. From there you'll need to figure out what's conflicting with the module and preventing it from working in your main app.
Comment #6
new_B commentedI installed private download on a separate installation, first by itself and then enabling the content access module but it works as expected. I don't know what other modules could be conflicting with it on my current installation.
The issue, as described above is that when I click on the link to the private file initially, when logged in, it results in an automatic logout, making the user "anonymous" and thus, not having access permissions to the file.
Do you have any ideas of what may be causing this to occur?
I also noticed that the default settings at /admin/settings/private_download file headers is
Could it be related to that in any way?
Comment #7
johnhanley commentedOops, sorry for missing your other question.
Hmmm, that's totally weird. Honestly, I don't know what could be causing that behavior. You'll need to go through your list of modules and figure which one is the culprit.
The default header is pretty standard and has proven to work in a wide variety of situations. 99 times out of 100 you don't need to change those definitions.
In any event, it's good that you were able to confirm Private Download is working correctly (albeit with your test application).
Comment #8
johnhanley commentedComment #9
new_B commentedOkay...After a while of still not getting it to work...and lots of "hair-pulling", I went back to the issue and realized that there is an issue after all, at least on my installations. I also realized that the new installation that I tested and said worked correctly really didn't, since I accessed the website, without the www.
The following are steps to recreate the issue:
When I access the site without the www in the URL right at the beginning, then there are not issues.
Access to private file => access granted!
I think it can be fixed some how by a server configuration or maybe htaccess but am not sure how. Any help/suggestions would be greatly appreciated. Thanks in advance.
Comment #10
new_B commentedOkay...I managed to solve it. Just in case anybody experiences this issue, here's what I did.
You need to ensure that the $base_url is set in /sites/default/settings.php. E.g.,
$base_url = 'http://www.mysite.com';Comment #11
johnhanley commentedThanks for following-up.