Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a link to a downloadable file in Orchard CMS

Tags:

orchardcms

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!

like image 671
Johanne Avatar asked May 19 '11 00:05

Johanne


2 Answers

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).

like image 124
Piotr Szmyd Avatar answered Nov 06 '22 06:11

Piotr Szmyd


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.

like image 44
Bertrand Le Roy Avatar answered Nov 06 '22 06:11

Bertrand Le Roy