Wondering if someone can offer some advice on the best way to approach the following.
A client has requested, the option to provide a link where a logged in
member with the correct permission can download a zip file containing
various documents from a media folder.
The site is using role based permissions for members and the
media section is structured with a products folder, with sub folders for
each product. Each product has a sub folder for the download documents.
My plan
is to use an XSLT to list all the files contained in a documents
folder and display a download all link. As not
all logged in members can view or download the zip file, I thought of
adding a new member property of type true/false called 'Download
Documents'. Which would be tested in the XSLT and only list the files
and display the download link, if the member has access and download
documents is true.
The part I need advice or help is on the best approach for creating the zip file, should I use a usercontrol or is there a less complicated approach.
If you are doing all this from within XSLT, I'd probably suggest you create an XSLTExtension to zip the files up for you and returns a path to the zip file (probably create it in the /Media folder so that it can be downloaded)
For an example on how to zip up media items, you might want to take a look at the source to my Export Media package which does just that, but as a context menu action in the backend, but it should at least give you an idea of the code you'll need to use.
Does this create the zip file in memory and then disposes of the file once downloaded - sorry if this is a silly question, but this would ideally be the approach that I would like to use.
Not used DotNetZip before, but will have follow some of the examples.
In my case it saves it straight to the response stream, and launches a save file dialog.
The problem you'll have is that I don't think you can do that from within an XSLT extension as they are all just static methods (I may be wrong), hence why I suggested to save to temp folder, and just return a link, so they can click it and download.
If you just want to output to the response stream instead, you could create a /base method, or regular aspx page you can redirect to, passing in the ID's of the media items and just zip them up in the same way I do. Really, there is 1001 different ways you can do it, so it's whatever works best / simplest for you.
Download all documents
Hi Guys,
Wondering if someone can offer some advice on the best way to approach the following.
A client has requested, the option to provide a link where a logged in member with the correct permission can download a zip file containing various documents from a media folder.
The site is using role based permissions for members and the media section is structured with a products folder, with sub folders for each product. Each product has a sub folder for the download documents.
My plan is to use an XSLT to list all the files contained in a documents folder and display a download all link. As not all logged in members can view or download the zip file, I thought of adding a new member property of type true/false called 'Download Documents'. Which would be tested in the XSLT and only list the files and display the download link, if the member has access and download documents is true.
The part I need advice or help is on the best approach for creating the zip file, should I use a usercontrol or is there a less complicated approach.
Thanks in advance
Eddie
Hey Eddie,
If you are doing all this from within XSLT, I'd probably suggest you create an XSLTExtension to zip the files up for you and returns a path to the zip file (probably create it in the /Media folder so that it can be downloaded)
For an example on how to zip up media items, you might want to take a look at the source to my Export Media package which does just that, but as a context menu action in the backend, but it should at least give you an idea of the code you'll need to use.
http://exportmedia4umb.codeplex.com/
Matt
Hi Matt,
As always thanks for the great advice and the link to the source. When looking at the source you save the zip file with:
Does this create the zip file in memory and then disposes of the file once downloaded - sorry if this is a silly question, but this would ideally be the approach that I would like to use.
Not used DotNetZip before, but will have follow some of the examples.
Thanks
Eddie
Hey Eddie,
In my case it saves it straight to the response stream, and launches a save file dialog.
The problem you'll have is that I don't think you can do that from within an XSLT extension as they are all just static methods (I may be wrong), hence why I suggested to save to temp folder, and just return a link, so they can click it and download.
If you just want to output to the response stream instead, you could create a /base method, or regular aspx page you can redirect to, passing in the ID's of the media items and just zip them up in the same way I do. Really, there is 1001 different ways you can do it, so it's whatever works best / simplest for you.
Many thanks
Matt
Hi Matt,
After watching the XSLT extensions video, it looks like your right about the use of only static methods.
Thanks again for your advice.
Eddie
is working on a reply...