views:

292

answers:

2

This is a web service call which I wrote that is intended to receive a WAV file via a POST and store it in the web-app server's local file system (IIS). Is there a simple method to store the file and if so would someone be so kind as to provide a C# example?

+1  A: 

You'll need to have write access to the directory you want to save to.

Make a FileUpload control, then call its SaveAs method in a postback.

SLaks
+1  A: 

If you're writing a REST service, use the following code:

Request.Files[0].SaveAs(/* some file path */);

Either way, be aware of the security issues - make sure the filename has a .wav extension and don't trust the file to be correct.

SLaks