Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Nielsen 159 posts 257 karma points
    Jul 14, 2010 @ 22:26
    Peter Nielsen
    0

    Accessing files on the server from umbraco

    Hi people,

    Im trying to make a mp3-download shop in umbraco, and im stucked where you have to assign the mp3-files to the artists in umbraco.

    I want something like when you create a new album node to the artist node. Then there should be a datatype or something where you can digg into the server and select the files located on the server.

    Is there a way it can be done?? The mp3's cant go to the media library because it will give the users a way to access all the mp3's on the server without buying them.

    Hope to hear some good and creative sugestions..

    Thank you,

    Peter :-)

  • Jonas Eriksson 930 posts 1825 karma points
    Jul 14, 2010 @ 22:38
    Jonas Eriksson
    0

    Hi!

    There are some approaches for that, one is to use media but to handle the particular file extension with a httphandler (http://forum.umbraco.org/yaf_postst4062_Access-restrictions-on-media-files.aspx) another is to go your way storing the file some other place and transfering the file, for example with Response.TransmitFile(file.FullName); (http://dotnetslackers.com/community/blogs/haissam/archive/2007/04/03/Downloading-Files-C_2300_.aspx)

    There's also a project "Protected Media", by Dirk De Grave, http://our.umbraco.org/projects/developer-tools/protected-media, but I think it also requires some DIY.

    I'm up to something similar soon and would be glad to hear how you progress.

    Regards, Jonas

  • wolulcmit 357 posts 693 karma points
    Jul 14, 2010 @ 22:46
    wolulcmit
    0

    I think you could still use the umbraco media section to store your files, but I guess you'll have to either stream the audio content somehow (though a plugin architecture like flash or silverlight... maybe even html5 <audio>), and make sure you ensure that the source to your files are hidden. I've done something similar for a friend.... but there are just javascipt calls to my flash audio player so there's nothing to stop anyone looking at the html source and finding my urls to the actual mp3 files.

    you could something similar to this video example http://flowplayer.org/demos/plugins/streaming/secure-streaming.html

    - Tim

  • Peter Nielsen 159 posts 257 karma points
    Jul 14, 2010 @ 23:20
    Peter Nielsen
    0

    Jonas> The protected media would require that the user is logged in with user/pass.

    The Response.TransmitFile solution sound maybe good i think. But can i use it inside umbraco where to pick the files?! Or do i have to make a tekststring af something for every file, and insert the path to the file?!

    Tim> The flowplayer solution looks like if i want to stream the files, and not do download them. Or am I wrong here? :-)

    /Peter

  • wolulcmit 357 posts 693 karma points
    Jul 14, 2010 @ 23:35
    wolulcmit
    0

    Hi Peter, oops - yes I was imagining a stream/listen before you buy scenario.
    If you're taking payment from people though, wouldn't that require that they be logged in somehow? so the protected media package may be of some help?

  • Peter Nielsen 159 posts 257 karma points
    Jul 15, 2010 @ 10:49
    Peter Nielsen
    0

    Well.. I dont think it is required to have a login when you take payment for theese things. Ive seen pages without. But maybe it could make it all more easy with login. And then when a user buys a mp3 he/she has unlimited access to this particular file. Then ill have to make a script with usercontrols that when people byes a file their user gets permission to the file. And then when you are logged in you can download this file. Isnt that the way to do it maybe? Can you see any complications?

  • Jonas Eriksson 930 posts 1825 karma points
    Jul 15, 2010 @ 11:17
    Jonas Eriksson
    0

    You don't necessarily need to login the users to get the access, if you create a download handler you can do whatever you like, for example use a query-string with a guid that works for authentication for one file and one day, or something like that.

    However it's nice for the users to have their purchases registred and listed somewhere. Also for you to market new products or whatever it's good to store e-mail-addresses. For my similar function I am going to ask my new visitors for e-mail-address and create send them a password or a login-url.

     

  • Peter Nielsen 159 posts 257 karma points
    Jul 15, 2010 @ 12:03
    Peter Nielsen
    0

    Yeah.. I thinks thats my solution too...

    But how will you assign wich files the users can access with the protected media package? :)

  • Jonas Eriksson 930 posts 1825 karma points
    Jul 15, 2010 @ 12:21
    Jonas Eriksson
    0

    I will change the package code in that case, but I really think I will create a rather simple user control myself and not using protected media package. I will need to store the file access information somewhere, a db-table with fileid, username (or ip-adress), date and guid (which might be required in querystring for download - as an alternative to logged in user).

    See also http://our.umbraco.org/forum/developers/api-questions/3949-Protected-Media- especially the last comment by Niels; just let IIS stop serving files from the /media folders + stream it via a proxy page. "That way the anonymous user won't have read access to /media but the application pool user will (ie. asp.net reading and streaming the file)."

Please Sign in or register to post replies

Write your reply to:

Draft