Click here to Skip to main content
11,922,641 members (56,827 online)
Rate this:
Please Sign up or sign in to vote.
come on man bring me out from this sound playing issues i have following code that work fine in IE but not in other browsers what's the solution for that please help me out.

DirectoryInfo di = new DirectoryInfo("C://Users//Public//Music//Sample Music/Kalimba.mp3");
//FileInfo[] fi = di.GetFiles();
string FilePath = di.FullName;
if (BrowserName == "IE")
scr = scr + @"<BGSOUND SRC='" + FilePath + "' LOOP='1'></BGSOUND>";
else if (BrowserName == "Chrome")
scr = scr + @"<embed src='" + FilePath + "' ";
scr = scr + @"AUTOSTART='True' name='chm' LOOP='true' height='0' width='0' volume='85'></embed>";
else if (BrowserName == "Firefox")
scr = scr + @"<embed src='" + FilePath + "' ";
scr = scr + @"AUTOSTART='True' LOOP='true' name='firfox' height='0' width='0' volume='85'></embed>";

IE working fine with bgsound tag but other 2 not working although i tried bgsound in other 2 also but didn't work. please give a solution for that. and i wanna play file from user's own localdisk as see in DirectoryInfo.

Usman Ali
Posted 25-Sep-12 3:25am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

"and i wanna play file from user's own localdisk as see in DirectoryInfo."

You can't. Your server has no access to the client local disk: the DirectoryInfo you retrieve will for the the server disk, not the client.
usmanali.ali843 25-Sep-12 8:46am
But why it's not playing for chrome and firefox in my above code as it's being playing in IE correctly then what's the problem with the path in chrome and firefox.
usmanali.ali843 26-Sep-12 8:53am
Is anyone there who can tell me how can i get complete path of files uploaded by client as (C:\Users\Documents\ABC.mp3) given by File Uploader control any other way to get complete path of client's uploaded files in and in all browsers???????
OriginalGriff 26-Sep-12 9:35am
You can't. Security won't let you - even by default - know what is behind the client browser (except in special circumstances which do not apply in 99.99% of situation". For all you know, the device browsing to you may not have a drive as you would recognise it: it could be a phone, an Android tablet, or even an internet equipped fridge!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.151125.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100