By hzakaryan on
Hi All,
I have a simple task that i could not figure out.
I am using Drupal 7.
Want to make a MS Word 2007 document downloadable, so when the user clicks the link he/she downloads the link.
I put my word document in /sites/default/files directory, after creating the link and clicking on it i get
"the requested page can not be found" message.
I tried playing with permissions, but still no luck.
Is there anything that i an missing here?
Will appreciate any help...
Comments
What's up DOC (or docx)
It would be better if you used the filefield to upload the Word docs. Just add support for the file types doc and docx. Then, when you create a node, you can upload the Word documents. Visitors to the node will see a link to download the file. I know this works as I have done it many times.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
RE: docx
I have my pages created as "Basic Page" and my links to word documents can be in the middle of the page.
When you are saying to use 'filefield' you mean creating a new field in "Basic Page" using 'Manage Fields' feature?
I did that way, attached a word document and when after logging out i click on it.
It just open ups instead of being downloaded.
Can you please be more specific on the advise, thanks?
Not sure how best to have the
Not sure how best to have the documents show up in the middle of the body copy. The new field needs to be at the beginning or the end of the body field. I guess there is some sort of WYSIWYG plug-in to insert it into the body, but I'm not familiar with that.
When you say"It just open ups instead of being downloaded" -- what program opens it? Does it just open in the browser window?
The link to the .docx file should be a link to download the document. However if the browser you are using has a plug-in or is configured to OPEN docx files, then it will do that. As far as I know you cannot force a file to download if the user has his browser configured to view a document. This is the case all the time with PDF. You could compress the document files to a zip format to force them to download.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
Media Module
If you don't already have it, I'd suggest you install the Media Module.
Also, are you simply loading the files via ftp into the given directory, or are you attaching them to Nodes? If you simply do it like this, then the file will be click-to-download enabled by default:
1. Create a new content type (Structure - Content Type - Add)
2. In the new content type, you'll give it a name, maybe change a couple basic settings (such as unchecking "promoted to front page" under Publishing options unless you want the content to always show on the front page by default..
3. Click Save and Manage fields... or something about fields, I forget at the moment, and not looking at my site.
4. On the next page, add a new field, and make sure it's of the type, File, and then use the Media Selector for the widget.
5. Click save
6. On the next page (unless you get one in between that just has one button - I forget), specify the allowed extensions... for isntance, if you only want to allow Word docs, then you'll want to say something like: doc, docx
7. Change any other settings you like, click Save or Ok....
8. Create new content, using your new content type. Click on "Library" to see items you've already uploaded - if you don't see anything, and you did upload files, then you'll need to change the media folder location or else change where you placed the files via FTP.
9. Find the file you want to include in the particular new Content item, and add it..
10. Save your new content.
Now if you want to just have the files there without creating a content item for each one, then I think you can do that another way. You'll need the Media and Views modules, I beleive. This I've not tried myself, but it appears to be an option.
You'll create a new view, and instead of the type item to include being content, you'll select files or media... I forget which I saw. Then you'll proceed to build your view off of the files... I'd imagine you will need to specify a folder somewhere... and I'd suggest you specify a few filters. For one, on the file extensions.
Now doing it the 100% views way would take away some of the control you normally have with Content. If you have each file associated with a content item, then you can easily unpublish the content item at any time to not have it show in a view (assuming you keep the default filter of "=is published"). If you only use files, then you forego this extra projection. Being able to publish/unpublish items can be very handy in different situations. For instance, it's an easy way to quickly remove content from the visable website without having to make a definite decision: Do I definitely delete this, or will I want to show it again later? For instance, think of seasonal items. If it's something about snow, you can build it one winter, then when spring comes, you can unpublish it, and next year, you can edit and republish it without having to build from scratch.
One more thought on this..
One more thought - from your initial description, you're just wanting to dump a bunch of files into a directory, and have the users basically pull up a basic web page with links to all the files, and click on them.. honestly, that's not what Drupal is built for, I don't think. For that, you might as well stick to basic HTML, and there are other tools on the web (I don't recall the names right off hand) that are built for this very purpose. But they are definitely far from visually attractive, and give you far less control than what Drupal does.
And another thought... I think there is at least one module which is setup to help specifically with Word and/or PDF files.. you might want to try searching the modules to see if there is something that'll help get you where you want to go with this.. if you have a hard time searching here, try searching http://drupalmodules.com
RE:
I would like to accomplish this without any new modules.
My site is on a shared hosting and it is already pretty heavy.
I am ftp-ing my word documents to the server.
And just used the links to the path of the server where they reside, it does work for PDF's but not for Word Documents.
I have my content as 'Basic Pages' and the links to word documents that i want to put in there.
If i use the attachment feature can i have my word document (links) in the middle of the 'Basic Page' content type?
I tried to accomplish the task this way: create new field type : attachment 2.add support for attaching .docx documents, it does let me attach, but the attachment goes to the end of the page, plus clicking on it, it does not download the document, it opens it.
Any idea how to solve this task without additional modules?
Or maybe using a very lightweight module?
Thanks!
Middle of page?
When you say middle of your page, are you talking middle of a particular block/view/content field as it shows on the page, or else just in the middle of the entire page? And do you mean horizontal/vertical/what?
Drupal is setup on a database, and the portion that handles content is separate from the portion that handles appearance. Much of the appearance is determined via your theme files. You can download various ones, you can create your own, or you can use an application that will do a custom theme for you.
Exactly what you mean by "middle of page" will determine how you proceed. It almost sounds like you just want it to show up before some of the other items in your view that comes out as a page. If so, you just drag the field for the Word Doc up higher in the list.... which leads me to another question (maybe I missed it) - are you using a View to control what shows on the page, or are you just allowing the content to go to the front page, and that is the page you're talking about? Or are you talking about when viewing the particular content?
If when viewing the particular piece of content, then you need to just move the field up in the fields list for that content type (under structure - content types - manage fields)
If it's what shows on a given page, controlled by a view, then you can specify what field goes where.
As far as horizontal centered vs left/right aligned, that's determined by your theme. The only other way I can think of for getting around that, possibly, would be to use the Insert module if it works for your site,...or similar.., and use that to allow you to insert the attachment into the body field.... not sure if that'll work so well with attached Word docs... I've only done so with images in the past.
Sorry my post is probably lengthy... wordy... I'm a little out of it today thanks to Benadryl. :0)
Thanks for the reply, When i
Thanks for the reply,
When i say middle of the page, i mean the middle of an html page which is a "basic page" content type.
I do create content types ('Basic Pages') and put my HTML in there.
And i know this html content is being saved in the database table.
So, there in the html i have links to .pdf and .docx file types.
My .pdf s are opening fine, but .docs documents are not being opened.
The link url is write but i am getting the message 'file in not found'.
Just need these .docx files to be downloadable after user clicks on them.
And i keep my .pdf and .docx file types in /sites/default/files/pics directory.
Any other ideas...
Thanks.
confused
I'm really confused because earlier you said "It just open ups instead of being downloaded" but now say, ".docs documents are not being opened." It is possible that your server isn't configured to recognize the docx mime type. See http://www.xdevsoftware.com/blog/post/docx-not-working-in-web-page-for-u.... I'd test with a .doc and see if that works.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
Sorry for the
Sorry for the confusion,
Earlier, when i was saying it was opening up, i was using the field type of attachment and attaching the .docx documents.
But in my last post i am just using the link to the .docx file in my HTML (which is inside the basic page content type), and my .docx documents reside in /sites/default/files/pics directory on the server.
I tried using .doc still no luck.
I'm at a loss
I'm at a loss. The only thing left is to check and see if linking to the full absolute url works. If not, maybe there are some extra hidden characters in the file name. Also check server permissions to make sure the files and folder are accessible. The only way this is a Drupal issue is if you can point to a full url that links to the document, but then when you link some text to this url in drupal it doesn't download. And if that happens, then the content type is probably not using full HTML.
A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com
Thank you
Hi mcfilms,
Linking to the absolute path worked for me.
It made the .docx downloadable.
Thank you.
Hayk!