Creating a link to a downloadable file in Orchard CMS
Asked Answered
R

2

6

I've spent several hours trying to figure this out; hopefully, it's an easy solution and the difficulty is simply because I'm brand new to Orchard CMS and no where near an expert web developer...

I've created a Products Download page and need to insert hyperlinks to files that exist on the file system.

the path to the file (on disk) is : c:\Orchard CMS\Downloads\ProductOne\File1.zip in the page editor, I insert a hyperlink reference with the following URL: /Downloads/ProductOne/File1.zip

When I hover over the hyperlink, it looks correct: http://localhost:12345/Downloads/ProductOne/File1.zip

However, when I click the link, I receive the following exception:

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Any help would be extremely appreciated!

Redhead answered 19/5, 2011 at 0:33 Comment(0)
P
6

If you don't want to play with source code and web.config files you should use Orchard Media feature. It allows you to upload files into Orchard filesystem and manage those. Links to files uploaded this way look like http://www.myorchardsite.com/Media/[Media folder path]/YourFile.zip

If you are not an experienced developer, I'd strongly advise you to take this approach. The only drawback is that you'd have to reupload those files into Orchard. But this is not as bad as it looks - you can zip them and upload as a single file (Orchard will take care of unpacking the archive if you check the checkbox below upload field).

Plutocracy answered 19/5, 2011 at 10:46 Comment(1)
Thanks!! My issue was that I was trying to resolve the download file with a relative path as opposed to a fully qualified path. That being the case, I should still be able to upload the files anywhere I need to on the site using FTP.Redhead
M
5

You need a web.config file that allows the files to be served. You can use one from one of the content directories that can be found in modules or themes.

Matthaeus answered 19/5, 2011 at 6:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.