I’ve heard the download of files is fixed in 5.3.1, but as long as 5.3.0 is still the current release, you’ll download executable with the ashx-extension which is very ugly and make the files unusable…
The code:
1 using Sitecore.Resources.Media;
2
3 namespace Sitecore.CustomMediaHandler
4 {
5 public class FileHeaderProcessor {
6
7 public void Process (GetMediaStreamPipelineArgs args)
8 {
9 if (args.MediaData.MimeType.Contains(“application”))
10 {
11 string fileName = args.MediaData.MediaItem.Name + “.” + args.MediaData.Extension;
12 args.OutputStream.Headers.Add(“Content-Disposition”, “attachment; filename=” + fileName);
13 }
14 }
15 }
16 }
And then add it to you pipeline:
<getMediaStream>
…
<processor type=“Sitecore.CustomMediaHandler.FileHeaderProcessor, Sitecore.CustomMediaHandler“>
</processor>
</getMediaStream>
Pfff now it’s time to have weekend
. Or actually, to have a short vacation! From tomorrow til tuesday I’m in Franca: snowboarding
!
