1

i have a file upload field type in my content type. so user can upload PDF file in that. i want to make password security for downloading the PDF. Can anyone help on this?

Thanks in Advanced.

1 Answer 1

2

There are two methods to ensure security of your files:

1) You can choose the "Private downloads" method in admin/settings/file-system, and

  • Either set your files path to a directory outside your web root so that they don't have an URL
  • or leave them where they are and protect them with some .htaccess directive (Order deny,allow and deny from all).

Apache won't serve them directly, and Drupal will read them and serve them with a virtual path system/files.

Then you can set permissions for the files by using an access control module (content_access or nodeaccess or node_privacy_byrole or og) and restricting access to the posts where they were uploaded, so that only some user roles can see them.

Caveats:

  • Your file-related modules must support the private download method
  • The private method is a bit slower because of the additional processing.
  • If you already have uploaded files their links may break if you change the download method now.

2) You can use pdf using mpdf module. it offers the ability to password protect your files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.