Tested with .mp3 extension, that isn’t the issue. I tried what I suggested to you and found that while clicking the link did actually link to the download of the .mp3 file, it wouldn’t play in the Yahoo Media Player. I did, however, figure out sort of a compromise. If you will set the files you wish to play up in a playlist (.xspf format), you can use linklocker on the playlist so that the location can’t be found (the playlist location will be encrypted) and therefore links will effectively be encrypted. I was able to verify that this method works - hope you find it useful. More info on using XSPF playlists here.
I can’t use the Yahoo Media Player since they generate <a> tags in addition to the playlist.
So basically the playlist is encrypted but you can still get access to the file and download it.
Not really useful to protect the file
So I switched to another popular player (http://www.jeroenwijering.com).
I tried your script with an encrypted mp3 file as well as a XSPF Playlist.
Unfortunately it still doesn’t recognize it.
When it’s not encrypted it works fine though.
I don’t get it why it doesn’t work. Do you have any more ideas?
Well I’ve spent most of my morning trying to find a way to assist, and I’m afraid I can’t help you with this. For my own site, I’ve customized the XSPF player to play the songs from a playlist and disabled making them downloadable, and of course, hidden the playlist. Just took a bit of Actionscript to make the magic happen - you can see the results at the best band website in the world! The player is usable embedded in the page, or via a popup - text link below the player. You can download the XSPF player here for free, but you’ll need to customize it with a bit of AS for desired results. Best of luck!
Something that may be a nice feature addition would be if the module checked the file extension (.pdf, .mp3, .jpg, etc.) and ended its created link with the same extension.
Example:
"site.com/files/doc.pdf"
passes through Linklocker and becomes
"1203984713048dsfphewhatever.pdf"
Keeping the extension would be very helpful for certain CSS uses like attribute selectors, so in the above example:
Thanks for the excellent suggestion - may incorporate it into a future version. However, this will not solve Vincents problem - tried dynamically adding & removing the extension on the end and it had no affect on operation of the Yahoo Media Player.
Either way, thanks for contributing with a great suggestion!
Perfect. Absolutely perfect. Thanks for this module!
One question, though. My current project doesn’t really require protection of the link or anything. I just want an easy way for people to download instead of play (I’m giving them a choice for either one).
Is there a way to set the link so it never expires? If I enter 0 as the expire time, will that do it?
It says that it defaults to 5 minutes. I noticed this when I refreshed the page that originates my download, and then went to make coffee. I came back and clicked a link and it wouldn’t work because it had expired. At least that’s what I think happened. Another refresh and it was fine again.
I’m not sure if I’m correct on this one or not but I thought I seemed to remember that if you set expires=“0” then it would automatically set it to 5 minutes for you instead. I could be wrong on that though. Should be easy enough to test though just create a link with expires=“0” in it and then don’t refresh the page for at least 5 minutes and 1 second okay a little more just to be sure, and then see if the link still works.
Yes, that’s correct behavior. By default it creates a link that will expire in five minutes. That’s to prevent someone from posting the link for general consumption - that link would no longer work. However, if you refresh the page that creates the link it will create a new link. In order to prevent this natural behavior, you would want to add a check before creating the link, perhaps to see how long ago the user was approved for the download. Based on this info, you could avoid creating a link altogether if it was more than a day, a week, whatever.
In order to prevent this natural behavior, you would want to add a check before creating the link, perhaps to see how long ago the user was approved for the download. Based on this info, you could avoid creating a link altogether if it was more than a day, a week, whatever.
Okay Brad I’m either very tired or missed that tutorial somewhere
How would you go about doing this kind of thing? Would be great for when you offer downloads in a secure area but want to only let them download for say 24 hours and then that’s it.
Would be great to know how to do that if you have the time?
Thanks again for such a great module that many people must be finding really useful in here.
I’ll try to find the time to post a tutorial on how to do this, or write a module to automate it - just a matter of finding the time and that’s in short supply lately.
For myself, I’ve simply created a script that emails encrypted links to the user once IPN is received from Paypal - saves me the trouble of them having to be members of the site to make a purchase - but they can’t go view download links on the site yet, as I’m not storing the links in the DB. This way, if they need something more, they can just email me.
Anyways, will try to find the time in the near future to further explain. I’m debating writing a “pro” version of this module that will do additional things like tying into Paypal & emailing links & such.