Download file

Kimsan MRP asked on January 25, 2016 03:31

Hi all, I have a problem with download file. I would like to download file document that I have uploaded into one folder in CMSdesk. I use repeater webpart to show all documents that's in that folder based on Transformation. I would like to click on "Download", it will download that file for me. Note: allow all file extension(.docx,.pdf,.jpg...)

Could you please advise me on this. If you have another way to work with download, please share it. I have no idea to work on it anymore.

Recent Answers


Anton Grekhovodov answered on January 25, 2016 07:42

Hi, You can use 'download' attribute for your links into transformation code. http://www.w3schools.com/tags/att_a_download.asp

0 votesVote for this answer Mark as a Correct answer

Kimsan MRP answered on January 25, 2016 08:05

Hi, I have used it already. but I cannot get file's extension as ".pdf, .docx,...", I just get only ".aspx". So I would like to get "document.pdf" not "document.aspx". That's why, I cannot download it correctly. So how can I get the extension as "pdf or docx or gif...."? Thank you,

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on January 25, 2016 08:55

Hi,

Have you created an attachment to a document or upload it into the content tree using the file page type?

You could also create use the media library, but it depends how you want link to this items and/or if you need document permission?

Greets,

David

0 votesVote for this answer Mark as a Correct answer

Anton Grekhovodov answered on January 25, 2016 09:10

If you use files from media library, you can show all fields from MediaFileInfo class type(CMS.MediaLibrary namespace) in your transformation. Example: <% Eval("FileName") %>, <% Eval("FileExtension") %> and etc, and you can add this fields to 'download' attribute

0 votesVote for this answer Mark as a Correct answer

Chetan Sharma answered on January 25, 2016 20:43 (last edited on January 25, 2016 20:47)

Hi,

What you need to do is specify a download attribute inside an anchor tag like this

I am putting this code in quotes otherwise it will also appear as a download link.

Download Your Expense Report

You will be all set with download.

Thanks, Chetan

2 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on January 25, 2016 22:06

You can configure files extensions in Settings -> URLs and SEO -> Files friendly URL extensions. But I'm not really sure this is your issue. So what actually happens when you click that link? Does it open PDF in new tab?

0 votesVote for this answer Mark as a Correct answer

Kimsan MRP answered on January 26, 2016 02:42 (last edited on January 26, 2016 04:53)

Hi, Again, I used webpart "Repeater" to show all document in one folder based on its transformation. I used attribute "download" of HTML5, but it's just working on Chrome. How to make it support with all browser? or should I need to create custom webpart?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.