Asp.net MVC Upload audio files

KraToS

New Member
Ok so I have a web application that I am trying to set up to allow a user to upload an audio file via httpPost. The problem I have is that the function I am using takes in the files as an HttpPostedFileBase. When I debug I can see the file format as an audio format but I can't seem to convert it. I did something similar with an image by using MemoryStream but I don't know if there is something similar for audio formats. Here is what I have on the client side to upload the files.\[code\]@using (Html.BeginForm("Index", "Image", FormMethod.Post, new { enctype = "multipart/form-data" })){ <input type="file" name="file" /> <input type="submit" value ="http://stackoverflow.com/questions/13869666/ok" />}\[/code\]On the server side I have this.\[code\][HttpPost] public ActionResult Index(HttpPostedFileBase file) { return View(); }\[/code\]Now what I am trying to accomplish is have that variable file converted into an mp3 format that I can use in a player of some sort. I am purposely avoiding using a file system where I store this file, it will be stored via database as a whole so I can't use the paths. I am trying to play the file directly. The ideas that I have looked into are changing the input type on the cshtml from "file" to something else that might work or finding a way to convert the HttpPostedFileBase would work as well. Any direction is appreciated.
 
Back
Top