Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Allow browser streaming of multimedia files

Reply
Thread Tools

Allow browser streaming of multimedia files

 
 
Michael
Guest
Posts: n/a
 
      01-26-2004
Hello,

I'm looking for a way to allow a client who clicks on a link the ability to
"adodb.stream" a multimedia file (mainly audio/wav) files, but the file they
would be accessing is outside the wwwroot (for security / traceability). I
don't want the "save as" box to open for streamable content. Basically I'm
trying to mimic the exact action, as if they had clicked a
www.mydomain.com/download.wav file, and allow the browser to open it up
automatically and save it if needed.

Here is the code I'm currently using to stream the audio file to the client.

Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile "c:\outside_my_wwwroot\test.wav"
Response.ContentType = "audio/wav"
Response.BinaryWrite objStream.Read()
objStream.Close

I'm sure it can be done, I really just probably need the appropriate headers
to tag to page (I'm using the adodb.stream object ).

Can anyone help me out with this?

Thanks!
--Michael


 
Reply With Quote
 
 
 
 
Michael
Guest
Posts: n/a
 
      01-26-2004
I've figured it out, for those ever interested, you need to do this.

Response.AddHeader "Content-Disposition", "inline; filename=anyfilename.wav"

key is in the "inline" not "attachment", If you want to force a "save as"
box, you just have to use attachment. You'll also need to set up the
ContentType, as so

strFileType = lcase(Right(strFileName, 4))

Select Case strFileType
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".pdf"
ContentType = "application/pdf"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".asp"
ContentType = "text/asp"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select

Response.ContentType = ContentType

"Michael" <raterus@localhost> wrote in message
news:%...
> Hello,
>
> I'm looking for a way to allow a client who clicks on a link the ability

to
> "adodb.stream" a multimedia file (mainly audio/wav) files, but the file

they
> would be accessing is outside the wwwroot (for security / traceability).

I
> don't want the "save as" box to open for streamable content. Basically

I'm
> trying to mimic the exact action, as if they had clicked a
> www.mydomain.com/download.wav file, and allow the browser to open it up
> automatically and save it if needed.
>
> Here is the code I'm currently using to stream the audio file to the

client.
>
> Set objStream = Server.CreateObject("ADODB.Stream")
> objStream.Open
> objStream.Type = adTypeBinary
> objStream.LoadFromFile "c:\outside_my_wwwroot\test.wav"
> Response.ContentType = "audio/wav"
> Response.BinaryWrite objStream.Read()
> objStream.Close
>
> I'm sure it can be done, I really just probably need the appropriate

headers
> to tag to page (I'm using the adodb.stream object ).
>
> Can anyone help me out with this?
>
> Thanks!
> --Michael
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stiff dicks stilesproject streaming media host streaming mediasolutions streaming media funduk Java 0 11-04-2008 12:35 PM
newbie: allow deny vs deny allow Jeff ASP .Net 2 09-19-2006 02:12 AM
[SIP] Multimedia, TV and radio streaming kael UK VOIP 3 07-09-2006 11:44 AM
Location element in the Web.config file. Allow System Admin whole directory, allow others specific page Ryan Taylor ASP .Net Security 1 09-09-2004 06:52 PM
Multimedia files...how to view Bud Computer Support 3 04-21-2004 06:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57