Drupal Document module

Document is a complete Document Management System for the Drupal CMS. I am still working on some parts of the module and hopefully, its first release should be available soon.

The official page for the module on drupal.org is this:

The current page is the permanent address for the module on my website, where I would provide updates on the module development status, and links to some other resources I have created for using the module. You can also use this for discussing with me any issues you face while using the module. However, please file all bug reports and feature requests at the official module issue queue.

I will try to add a Demo for the module at my Sandbox site for Drupal as soon as possible.


  • Jun 18, 2011 - Drupal 7 version of the module is now available. Please help me in testing it and iron out any issues to create a stable release for the D7 branch.


Hi Rahul:

Sorry if this is not the rigth place to ask. Feel free to remove the comment if not.

I'm installling your promising Documents module for Drupal 6 and after enabling and saving the module I get an error:

"Parse error: parse error, unexpected '{' in PATHTOMYROOTDRUPAL\modules\document\document.module on line 289"

I've been reading the php code in this line but I can't find anything wrong. Any clue?

Thanks in advance!

rahul's picture

Hi Enrique, a possible reason might be PHP version. I think I should mention this on the Project Page that this module requires PHP 5.

what about this error on drupal7?

Warning: Parameter 1 to document_settings_form() expected to be a reference, value given in drupal_retrieve_form() (line 787 of /var/www/drupal/includes/form.inc).

this error showed up I click on Configure!

rahul's picture

Hi felix, this module's D7 port has some issues that I am trying to take out time to fix. At the official issue queue of the module on d.o. (here), other users have reported similar issues and provided fixes/patches too. Can you please try using one of them.

Hi Rahul:

I was wondering if you can give me a hand. i installed your module onto my drupal site, everything looks good exept when i try to add a document type. after i type in the document type onto the text box and press the button to add it it give me an error. the error only reads "error"

Thank you in advance


rahul's picture

Hi Oscar, its pretty hard to tell from that description, what's going wrong and where?

Can you please try to produce the Request & Response when you click "Add Document Type" button? You can capture these either through Fiddler or through Firebug.

Thanks for the quick response, not sure if this is what you mean.

<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL /usr/share/drupal6/index.php was not found on this server.</p>
<address>Apache/2.2.14 (Ubuntu) Server at  Port 80</address>
rahul's picture

Hmm... not sure, maybe related to clean urls not being enabled!! Cannot be sure without seeing the actual environment...

That did it, thank you so much



after installing the document module on my stage enviroment, I tried to define document types, but always received an error message when entering something in the field:

Add Document Type:

What needs to be entered their? (f.e doc or .doc) did'nt work


rahul's picture

Hi Ullrich, Document Type is basically a regular Drupal Taxonomy vocabulary which the module uses to organize documents. You can enter any classification for the document, e.g. Report, Guideline etc. However, I don't see a reason why doc etc. should also fail. Please ensure that clean urls are enabled on the server.

Hello, I wanted to ask how to fix document table sort error. If i first search document and again sort table

then i jump in new window (file - screenshot)?

Thanks for the help

rahul's picture

Hi diskr, I was not clear on what you meant by "then I jump in new window". I checked the screenshot, but was not able to understand. Can you please elaborate?

Thanks for the help, rahul. I'll try to explain more widely. Go to documents search page (http://localhost/drupal/document). Here is serch documents fieldset and result table with sortable header. when I first want to sort, everything be well. I am getting this sorted table document. But if i first searching document and then sort table, then displayed table in a new white window. I make new beter screenshot. Please see


rahul's picture

Hi diskr, thanks for pointing this out. I have been able to reproduce this. This seems to be a bug in the code. I will try to resolve this soon and create a new release on the official Drupal project page.

Thank you very much,
I waited new release

rahul's picture

Hi diskr, the issue has been fixed. You should have available for download, a Beta2 version of the module soon on the official project page.

Hey, would love to see a demo of the document module in sandbox. Have a client that would like to see a demo. Any idea of when you might have one available?

rahul's picture

Hi David, I currently do not plan to make available demo for the Document module in my sandbox site. Why don't you install the module on a test Drupal installation yourself? It should not take more than 10 minutes to download and install Drupal together with the Document module for a demonstration.

Hi Rahul

I have installed the document module, created a folder to store the documents in, configured the module all with no problems.

My initial problem is that I placed a document (pdf file) in the relevant folder, but when I tried to access it via the documents gui the searches returned nothing.

file name: quote_template.pdf

I searched using keyword 'quote' and filetype 'pdf', to no avail.

Also, if, as I assume from a previous post that 'filetype' is not the extension, ie .pdf, but a catagory into which any filetype (based on extension) could be placed, how are the files meant to be uploaded? If my assumption is correct a category (type) would need to be allocated to it at time of upload.

I apologise if I am being obtuse but I am a bit confused at to the intended usage of this. I was looking for something that would manage a repository of documents, making them available for download, via a simple interface, to those authorised to do so.

I would be very grateful if you could enlighten me on this.

many thanks for your work on this module


rahul's picture

Hi Jon, you missed an important part. After installing and enabling the module, you should create and upload the document via the module itself. A document is a node, and you can create one from (http://example.com/node/add/document).

On the interface for document creation, you can upload the file that would be stored to the folder specified in the administration configuration. And the document should then be available for search and download via the interface.

From what I read of your requirements, the module should fit your needs perfectly. You can configure the permissions for the module to control who is authorized to create, search and access documents using the Drupal's normal permissions UI. Look for additional permissions under the document module.

Ah, exactly so. Many thanks Rahul. I was indeed being dense. Working fine now. Many thanks for your prompt response and indeed your work creating this module. I think that it will be perfect for my requirements.

Once again, many thanks for your help


Sorry to be a pain Rahul but I have another issue. When I set the module up it asked for a file path to store to store the documents on. I gave it '.../sites/default/files/docs'

I can upload a document, but it doesn't seem to save it there. I can search for it and find it successfully, but not download it. The download link points to '.../sites/default/files//tmp/' which returns a 'page not found' error.

Also, I would like to place a menu link in the navigtion block (or somewhere) labeled 'upload file) which links to the front-end of the module for users of to upload files. Is this possible. Please bear in mind that I am a total newbie at this, hence the dumb questions.



rahul's picture

Hi Jon, I do not see any reason for the upload path not working. However, a couple of observations regarding your particular input:

  • The path needs to be just "docs". It's always interpreted relative to the Drupal file-system directory. Thus, docs would actually map to "sites/default/files/docs" (assuming default Drupal file-system directory).
  • You have used "../" in your path. This could be the problem. This makes the document upload path outside the Drupal's file-system folder, to which Drupal (meaning your web-server) does not have write-permissions to on most set-ups. Thus, uploading (or trying to create that directory) might be failing with permission problems. So, try limiting the path to just "docs".

Regarding menu, any role with the "create document" permission would be able to upload documents to your portal. Users having this permission should by default see a link for "Document" under "Create Content" in navigation menu. You can add an explicit menu-item for the path "node/add/document" to any menu in your setup.

Thank you Rahul. I can upload, search and download now. I did find that I needed to right click on the download link and 'save target as' to download the file correctly. If I just hit the download button it tried to open the file (a pdf) in the browser and returned an error.

All good so far though. I will do the links and permissions thing on Monday.

Many thanks once again


Hi Rahul

A couple of questions:


'Anonymous users cannot post even if they have the permission' Is this because anonymous users would not have an email address for the feedback email? Ideally I would like anonymous users to be able to upload documents.

I'm not getting the feedback email at all. I assumed that if I set the Document content type workflow settings to 'published', the document would automatically be published and an email would be sent to the sender. This is not happening. Neither does it happen if I publish the document manually.

I'm sure that it is something I haven't done, but any help would be appreciated. Also is it possible to change the title from 'Create Document' to 'Upload document'

Is it also possible to remove the 'Year of Publication' field from the download page, as it's a bit too vague for my purpose?

many thanks


rahul's picture

Hi Jon, its been sometime since I last wrote code for this module in a major way. I need to look at the code but yes, mails was probably the reason I chose not to allow anonymous users to create documents. I agree it would be more useful to allow them, and I would look forward to changing this is a future release.

I have a couple of sites where this module is deployed and I am getting emails regularly. An email is only sent when the document is published manually, but nevertheless, you should be receiving such mails. Please verify the admin settings for the module at 'admin/settings/document' and ensure 'Email the Creator of the Document when it is published by administrators' option is checked.

Regarding other customizations, like title changes, you would need to make them manually in code currently, but I would provide admin options for them in future. Lastly, you cannot remove 'Year of Publication' field. Instead what I would suggest is to set that field to a value using jquery at the document creation page ('/node/add/document') and set its <div> visibility to hidden again in jquery. This would ensure that a correct value for the field gets submitted, but user does not see this field.

Hi Rahul

Many thanks for your reply, however:

<set that field to a value using jquery at the document creation page ('/node/add/document') and set its <div> visibility to hidden again in jquery>

is waaaaaay outside my humble skillset. In actuality I do not know how to do that. I have the jquery module but that's all I know.

I'm sure that you're very busy but if you have the opportunity to post a code snippet............:)

many thanks again for your response


I really like your module, but is it posible to disable the document search? I'm using the drupal search with search_files and I don't want my users to be confused about the different search options

kind regards,

rahul's picture

Hi Natascha, you should not reply to an existing comment but start new ones for unrelated comments. Anyways, you can disable the menu option for the document search from admin/build/menu and then configure the permissions for the document search in admin/user/permissions. This would ensure that your users do not see document search page and are unable to directly access it by typing the url also.

Hi Rahul,

What lines do I need to comment out to remove the document revisioning?

Many thanks

Chris Wray

rahul's picture

Hi Chris, revisioning is tightly integrated into the module. You cannot remove it easily without making major changes. I have not really tried it, but try commenting the following set of lines in document.module for the latest version to see if it helps:

Lines 245 - 248
Lines 263 - 265
Line  280

That might help you change attached documents without forcing you to create a revision.

Experimenting with your module -- great so far!  A couple questions:

1)  Is it possible to organize documents by CATEGORY?  So for example, when uploading a doc you specify that it belongs to the "Account Department" or "Human Resources".  Then on the search page you'd see a drop down menu which would allow users to only display (or search) documents within a specific category.

2) Is there a max number of docs you'd recommend NOT exceeding?

Thanks for your help.

rahul's picture

Hi Michael, to answer your 1st question, the documents are organized by category, but the module's search page always displays all available categories for searching.

However, accomplishing what you need should not be too difficult. The module supports Views and you can easily create a custom search form using CCK and display the results using Views.

For the second question, the module does not impose any max number. In fact, module integrates tightly with Drupal core, and the documents uploaded are managed by Drupal's file-system functions. So, you can upload any number of documents as permissible by your disk space limits.

Good morning.  The specs for this system have evolved a bit over time. How about organizing docs by category AND subcategory?  Is there any way to work a subcategory search into the process?

Thanks again.

rahul's picture

Hi Michael, You can try achieving what you want through CCK/Taxonomy. I have been thinking over how to incorporate extensibility into the module, and maybe for the next release, I will add support for CCK fields into Document. But this really depends upon how much time can I devote to this module outside my commercial commitments.

Hi Rahul. One questions: whath do you think about the use of db (mysql) to store docments? For a large number of documents to manage I think to obtain some benefits with this stategy. Do you think to do that should be very difficult? I'd like to work at this project.

Thanks for your advice.

Simone Marcucci

rahul's picture

Hi Simone, I do not think its a good idea to store documents (unless you have some optimized DBMS specifically for storing documents).

It would bloat the database too much as the number and size of documents grow, and would put too much load on the database server if large documents are downloaded frequently.

What benefit do you see coming from by storing documents in db?

Please let me know how you would like to contribute to this project? Any help would be welcome!!

Thanks for your reply Rahul.

Advantages of storing document in database, in my opinion, are : 1) database integrity easier and safer to obtain than syncronitation file system/db 2) Easier preventing a user to edit a node (document) which is currently edited by another user (i think this functionality is not implemented now, but i'm not sure). I agree with you with the disadvantage of greater load on database server, but we are sure that this matter don't touch filesystem when the number and size of documents grow? Only you, whith your experience, can answer to this question. Compliment for wonderfull Greece photos... when you go in Greece, take a trip in Italy, we can meet ;-)


rahul's picture

Hi simone, there is no doubt that DBMSes are better at managing integrity and its easier to back-up and restore databases. But this advantage is far outweighed by the disadvantage of bandwidth used in transferring files between the db and the web server. Suppose you are a popular destination for some kind of downloads (documents, images or something). Okay take the case of the Greek images you referenced. They are 26 images, with an average size of 0.5 MB.

Anytime a user looks at those images, I am looking at 13 MBs of data being transferred from db to web-server and then from web-server to browser. Apart from the load on the db server, notice the effective download time doubles. 13 MB 2 exchanges instead of only 1 between the web-server and browser.

Not to mention that it limits my capability of scaling out at a lower cost. To optimize things, I can easily keep those images on different file-servers or different disks on the same server. You would acknowledge that keeping them in different dbs on different servers would be far more complex than keeping them on disc on different servers or different discs.

You can easily create shell scripts (and many are available out there freely) for enforcing integrity, synchronizing, backing-up and restoring documents from disc. I am not just getting enough time, I have a long list of enhancements for this module.

There is no built-in support in Drupal or in this module to prevent simultaneous editing of a node from multiple users. This would not cause an issue in db, but can certainly cause file corruption on disc. This is actually a good point, and I would look to incorporating feature to prevent such corruptions.

And I am not a final authority on this matter. I would rather say that people managing documents in clouds (Google Docs team, rapidshare etc.) can present better views on this topic than me.

Lastly compliments should go to Kostas, my Greek friend who sent me those photos...

I've installed the module and think it works great but I had one quick question.  I can't seem to figure out how to add anything to the drop down list "Document Type."  The only option is "None selected."  I'm sure that I am missing something painfully obvious but I can't figure this out on my own.  Thanks for your help.

rahul's picture

Hi Matt, Please go to Document Administration section (Admin->Settings->Documents) and add the needed Document Types before trying to create a document.

Hi Rahul. One questions: what about a document module version for drupal 7? is it very difficult translate the module in drupal 7 version or is possible to install version 6, as is, on drupal 7?

Many thanks

rahul's picture

Hi Marc, a Drupal 7 version of module is certainly on the cards.. I will try to take sometime out in the next weeks and look for an upgrade. I do not think Drupal 6 version will work on 7 with the extensive changes in Drupal 7 API, and I cannot guess the amount of work involved too, as I am yet to have a close look at the new API...

Hi Rahul

Just flagging my interest in a D7 version of the module.

many thanks


rahul's picture

Hi Jon, I completely understand people's interest in a D7 version. I promise you will have it soon.

I love this man !!!!


rahul's picture

Guys, I have started D7 migration for my Drupal modules. Yesterday late night my time, I committed the D7 version of my Reference links module for Drupal. And started work on D7 version of Take Control module. I will try to complete that asap and then next in line would be document module.

Great stuff Rhul. Many thanks for your committment to your modules and the people who use them.

is there any AND or OR functionality built into the search?  There doesn't seem to be based on my testing, but wanted to check.

The issue I'm experiencing is this.  If I have keywords listed for a document as "house, dog, tree" and do a keyword search on "house, tree" the document does NOT get returned.  It seems like I have have to perform the keyword search in the EXACT order of the keywords else it doesn't work.  Is that how the search functions on your end?