Sajid Hussain

Sajid Hussain

  • 1.1k
  • 510
  • 95k

How do i give path to soundplayer

Feb 10 2016 1:45 AM
I have a web form in which i have requirement to browse an audio file using file upload control,and then a button to upload and play this file to folder on the server,from there i get the path to it soundplayer,
My problem is that when i pass path in this way its work fine
Hide Copy Code
SoundPlayer playthewavfile = new SoundPlayer(@"G:\backup\LTM.CTP.WEBFORM\LTM.CTP.WEBFORM\Audio\q1.wav"); 
but i want to give the path like this
Hide Copy Code
FileUpload1.PostedFile.SaveAs(Server.MapPath("~/Forms/Upload/" + fileName));                 string PATH = System.IO.Path.Combine(Server.MapPath("~/Forms/Upload"), FileUpload5.PostedFile.FileName); SoundPlayer playthewavfile = new SoundPlayer(PATH);  playthewavfile.Play(); 
here its give exception of invalid path?

Answers (3)