1

I'm trying to create a link on my webpage to a file on my C: drive, but for some reason ExpressionEngine switches my backslashes into forward slashes.

For example < a href="file:\\C\data\text.doc" > will be turned into < a href="file://C/data/text.doc" >

And therefore the link doesn't work. What to to?

  • Why are you trying to link to your c: drive? You need to upload files to your website if you want your visitors to be able to access them. – Adrian Macneil Jan 23 '13 at 7:20
  • Because all my visitors will be having access to the same C: drive (we are using the site at the same office). – user878 Jan 23 '13 at 7:53
  • On the same computer? C: drive is local. Also, you need to explain where you are putting that link. Are you putting it directly in your template? – Adrian Macneil Jan 23 '13 at 8:46
  • I only used C: drive as an example, I mean a common server that we all have access to at my work. The site will be used as an intranet so I will need many links like this. Links would be put mostly on weblog entries. – user878 Jan 23 '13 at 9:05
  • Ok I see. So you are adding links in a wysiwyg text field? Are you using built in EE Rich Text Editor, or Wygwam, or one of the other plethora of plugins? – Adrian Macneil Jan 23 '13 at 10:49
2

Even for an intranet, you want the files to reference the internet domain, such as

http://office.mydomain.org

You can upload files from the C: drive, but Adrian mention ExpressionEngine and probably every content management system (CMS) will expect the files to be stored in the web area of your machine. Pointing to the generic C: drive, is pretty much like saying, these files are located on every employee's computer who attempt to use them. The C:drive is local machine reference.

You want to reference the server. This can be done by IP address, as well, but is best done by a domain name, even if its internal.

If your website is hosted elsewhere from the intranet, just call your ISP, and ask them to point a subdomain, to the IP address of the machine you are using for the intranet. Anything like, office., staff., internal., in front of your current domain name should work.

Then just place the files in a folder, within the web server area. So if your structure was like:

public_html
-- /system/
-- /images/
-- /themes/
-- /files/

The reference to the files will then become:

http://office.mydomain.org/files/{file_name}

or you can use the reference, just /files/{file_name}

If you have lots of files, I also recommend grouping them under the files or downloads folder. Just create sub-folders. This will make uploading files using the file manager or something like 'Assets' by Pixel & Tonic easier, when they don't have to try to display 1000s of files at a time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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