I have a PhoneGap application that contains mp3 files, I have their path in a variable — uses JS
Back End is an MVC3 app with SQL server using c#
My question is how do I send a file from my app using javascript to the back end and then store it in the sql server?
I am very new to using js and I would greatly appreciate some guidance!
You could use standard HTML form to upload a file on your server. I have recently
answered a similar questionabout uploading a file in ASP.NET MVC.If you want to use javascript on the client you could take a look at some of the javascript file upload plugins that exists such as
UploadifyandFine Uploader. They allow you to provide additional user experience such as displaying upload file progress for example.As far as storing the uploaded file to SQL server is concerned, you could have a
varbinary(max)orFILESTREAMcolumn in your database in which you could store the uploaded file bits. Querying a relational database could be achieved with either plain oldADO.NETor using an ORM framework such asEntity Frameworkfor example.