I am trying to build a document management system using taxonomy, views and CCK. However, instead of uploading documents to a file in the site directory, I would like just to have links to pre-existing folders on the shared hard drive. I am trying to create a custom content type that includes a link to a file on the shared hard drive, which could be something like

Z:\folder\folder with spaces in name\file.doc

CCK Link allows you to create a field for links, but it only allows URLs. When I try to put a directory address in I get the error message, 'not a valid URL'. What is the problem? Is it the spaces or the start of the address? Should I include the IP address of the server, for example?

Does anyone have any other ideas how I could achieve my aims, or how to hack CCK Links (including file and folder to hack) to achieve my aims?

Many thanks

Comments

choster’s picture

URLs can be programmed for because they follow a specific set of rules-- a protocol scheme (e.g. http:), a host (e.g. //example.com), and a file path (e.g. /foo/bar.html), with certain characters reserved and some disallowed altogether.

Local file paths will differ depending on your operating system and file system and how you've mounted the drive. My machine may be connected to the same drive, but I might have it appearing as the U or G or M drive on my system instead of the Z.

That said, have you tried using the file: schema? That is,

file:///Z|/folder/folder with spaces in name/file.doc

I don't think spaces are technically allowed (they should be escaped as %20), but in practice most web browsers will do the translation silently. By the same token, your browser may not allow you to load file: documents at all.

http://kb.mozillazine.org/Firefox_:_Issues_:_Links_to_Local_Pages_Don%27...

canyonbreeze’s picture

I do this easily on my Linux Debian server. I create a directory within the site that I can point to with Drupal. Then in that directory I put a symbolic link to the actual disk and directory I want to see.

For example...

Create the directory http://drupal.site/plays/
Then in that directory create a link: ln -s /media/otherdisk/directory/whatever/shakespeare shakespeare.
Then you will be able to access http://drupal.site/plays/shakespeare/
(Obviously your names will change).

Easy in Linux. I don't know how you could do it in Windows.

jannerick’s picture

Thank you both very much; I have managed to make it work by creating a directory in the htdocs folder in XAMPP (I'm running Windows, by the way), and by using the %20 space in the link.

Gerben Zaagsma’s picture

I am trying to achieve the same using MAMP on a Mac. Could you explain a bit more how the creation of a symbolic link works, I tried but it fails..

If I understand correctly I need to put an alias of a map on my hard drive in the sites/default/files folder? When I create such an alias and put it there it is not recognized though and I cannot figure out what mistake I am making.

TIA,
Gerben