This project is read-only.

Setup URL in List item to download a file

Topics: General
Jul 15, 2012 at 8:44 PM

I am new to Orchard and I am trying to setup a page with a list of documents where someone can click on the link and download the file.  I have setup a new content type for the list and I have setup the list. In the content type I have tried using a text field and a URL field to contain the address of the document. When I use the URL field it tells me the URL is invalid. I added a directory to the web site that will contain all of the word files listed. I beleive I just do not understand how to setup the URL properly to get it to work. The list shows up as a page and the element show up in the list. Would someone please point me in the right direction.

Jul 16, 2012 at 11:14 PM

Could you show us some sample urls that you're using that "it" tells you are invalid?
Note that if you add a directory that contains files, they will not be accissible via the browser by default, as the root web.config contains a setting that maps all requests to the HttpNotFoundHandler. It's easy to overcome this by copying the web.config file from the Media folder though. Or perhaps in your case, you could consider storing your documents in Media or in a subfolder, because that's the purpose of the Media folder anyway.

Jul 17, 2012 at 9:48 PM

Thank you for taking the time to answer my question. I changed the file location to Media as you suggested and the URL does work. Thank you. How would I setup a link as you would in just HTML <a href="some path">file description</a> that could be active on a page?

Jul 17, 2012 at 9:55 PM

You're welcome. I'm not sure I understand your question. Setting up a link is exactly done using the <a> element (and of course include the url in the href attribute). Or use one of the Html helpers that generate a link.

Jul 17, 2012 at 10:44 PM

Again Thank you. When I used the HTML editor I can include a link within a body of text which will do what I am looking for. This is a very nice tool. It is just a matter of learning how to use it.