public class FileController : ApiController
{
public async Task<HttpResponseMessage> Post()
{
if (!Request.Content.IsMimeMultipartContent())
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
var provider = new MultipartFormDataStreamProvider(HostingEnvironment.MapPath("~/App_Data"));
var files = await Request.Content.ReadAsMultipartAsync(provider);
// Do something with the files if required, like saving in the DB the paths or whatever
File.WriteAllBytes(files.FileData[0].LocalFileName+".png", File.ReadAllBytes(files.FileData[0].LocalFileName));
File.Delete(files.FileData[0].LocalFileName);
return Request.CreateResponse(HttpStatusCode.OK,"ok"); ;
}
}