When I try to define the path for a menu item, Drupal will only let me choose webpages to link to. How do I make it so that I can link to files on the server?

Comments

chrisbeaman’s picture

By menu item I mean like the FAQ in the left sidebar. If I want to set that to link to a PDF instead of to a page, how do I do that? (If I type the URL into the path box it says it is invalid, even though it's linked to the proper location on the server)

upupax’s picture

I've never tried this, but why don't you try this: enable upload module, create a content with the pdf attached, copy the link to the file, create a menu with that link..
Not sure if it's the best solution, but it should work..

Boobaa’s picture

It doesn't work, all one gets this way is an error: "The path '/sites/default/files/foo.pdf' is either invalid or you do not have access to it."

mcfilms’s picture

It seems you cannot use a relative link for anything BUT an existing page. You must use an absolute link, Try http://yourdomain.com/path/to/pdf.

That should work.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

Net Mystic’s picture

Confirmed that this DOES indeed work. Needed to do it myself. Thanks for the tip mcfilms!

Siekee’s picture

moved to new comment underneath instead of reply

Siekee’s picture

I'm aware of the difference between FF and IE on opening links to local drive. Problems are solved as far as links in a node are concerned ...

However, trying to add a link in a menu to directly open a file located on a local (intranet-)drive, fails ... I can't submit the menu-item
Message: The path ... is either invalid or you do not have access to it.
Structure of the path used: file:///C:/directory/document.pdf

I found a few forum items for d4, but none (so far) relating to drupal 6.

any help?

2dareis2do’s picture

I would like to be able to add menu links to tabs as displayed using quick_tabs

Am getting the following error:

The path 'mypath' is either invalid or you do not have access to it.

I guess this is because a tab is not a node but is none the less quite frustrating as the tab does exist! Works if I use an absolute url starting http:// however do not want to do this as will be broken when moving between dev staging and production environments.

bzsim’s picture

The solution above about using an absolute path instead of relative path does work, but what if you are building the site for someone who will not be web savvy? Isn't there a way to upload the file to a content type, then have the menu link to that content and the PDF opens directly? That way if the PDF changes in the future, the client can just edit the content and swap out PDFs instead of, for example, using FTP to put the PDF in a folder on the server.

meganmcc’s picture

I am in the same spot - I have a bunch of teachers who would upload their own pdf newsletters, but are not web savvy enough to build absolute links. Anyone come up with a fix, yet?

mcfilms’s picture

The solution/workaround to the above issue would seem to be either to have the menu link to a "PDF library" page or create a list of links that looks very much like a menu but is not. In either of those cases you could create a content type called "PDF" and include a file field (along with a title and description if you want). You could even use taxonomy phrases to group the PDFs (manuals, ebooks, brochures, etc.). It would be easy to add, upload and edit PDFs this way.

From there you could use Views to display all the PDFs in the library on a page under the correct taxonomy term. OR you could create a list of all the PDF files that link to the PDFs themselves and style this list like a menu. OR you could put dummy content in each PDF node and then provide a link to the node in the menu.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

sharuna’s picture

You have to upload the PDF file during content creation without saving and use the absolute path for the path url.