Using the XMl/XSL module, I've created several XML and XSL files to display some data that can not be easily done with the User Defined Table module. It works great. However, it has been asked that the link generated by my XSL file force a file download (similar
to Documents module). I'm not familiar with the __doPostBack javascript function, can I use this to force a download?
Download
I sure have. Unfortunately, it will launch the application (in this case Media player) and open up the document (in this case the video). My XSL file creates a streaming link (ie mms://www.companyname.com/videos/videoname.wmv) and a download link (ie ftp://
etc.). I want the download link to force a download and not launch an application. I'm using the FTP link to throttle the download. The Documents module works this way. One link opens up the document and the download link forces a download (even though is
all HTTP). How can I do this via XSL (HTML) using javascript or using some DotNetNuke trick? I realize now that the __doPostBack doesn't work this way. It actually sends a post back to asp .net and the DotNetNuke code knows to grab that reference and do something
with it. It's not set up to accept a path and force a download. I guess if there was an additional request for the DotNetNuke developers, it would be to provide a mechanism to force a download of a document/file.
If I remember correctly I think this may relate more to the configuration of the users OS/Browser. I don't think that the download module forces a download; rather (default browser behaviour) it will ask what to do if it has not previously been told how to
handle a particular type of file.
I have successfully done this for PDF files using sample code I found at http://www.eggheadcafe.com/articles/20011006.asp. When a user clicks the link, they are prompted to download the PDF file rather than it opening in the browser. I suspect this should also
work with other file types. Response.ContentType="application/pdf"; Response.AddHeader( "content-disposition","attachment; filename=MyPDF.PDF"); Cheers Paul
Just in case anyone was interested this is what I came up with: Please recall I have two links, one for media streaming (mms://) and the other for throttled download (ftp://). Below is a sample of the download link
Download
Um... correct me if I'm wrong here, but... ASF files are streaming files in-so-much-as that if you click the link to the asf file, it opens the media server with a UDP protocol for streaming content. If you save the 'asf' file, all it does is save the information
necessary for the browser to open the streaming link when you click on it. I only 'suppose' that because I've saved several asf links and the asf file is only a few KByte in size- yet the video / audio are several minutes in length. What I'm guessing you need
to do is link to the stream (mms://) for playback and to the stream's source file... .wma/.mp3/.avi/.mpeg/etc.... seperately. And maybe, need to alter the MIME types the server supports so that WindowsMedia Player and others don't recognize the file type and
then cause the browser to force a download. I am probably blowing smoke up my .... Well, anyhow... maybe that could help you out. What I've seen is that if the browser recognizes a file type according to MIME definitions then it will launch the application
associated with the file type. If the Server does not send a MIME type then the user is prompted with a 'Save As...' dialog. Good luck
housefly
Member
540 Points
108 Posts
Force Download
Jan 05, 2005 05:13 PM|LINK
housefly
Member
540 Points
108 Posts
Re: Force Download
Jan 05, 2005 10:18 PM|LINK
hooligannes9...
All-Star
16504 Points
2917 Posts
Re: Force Download
Jan 06, 2005 12:22 AM|LINK
housefly
Member
540 Points
108 Posts
Re: Force Download
Jan 06, 2005 02:51 PM|LINK
happyplace20...
Participant
1701 Points
344 Posts
Re: Force Download
Jan 06, 2005 04:06 PM|LINK
paullaj
Member
165 Points
33 Posts
Re: Force Download
Jan 06, 2005 04:59 PM|LINK
housefly
Member
540 Points
108 Posts
Re: Force Download
Jan 06, 2005 09:55 PM|LINK
tao_muon
Participant
795 Points
159 Posts
Re: Force Download
Jan 07, 2005 01:40 AM|LINK
haidar_bilal
All-Star
45609 Points
8730 Posts
MVP
Re: Force Download
Feb 20, 2005 09:55 AM|LINK
Professional ASP.NET 3.5 Security, Membership, and Role Management with C# and VB