You can inherit from MultipartFormDataStreamProvider and override either GetLocalFileName (launched after reading the contents of the stream) or GetStream (executed before reading the contents of the stream). In both cases, you have access toheaders.ContentDisposition.FileName
public class CustomMultipartFormDataStreamProvider : MultipartFormDataStreamProvider
{
public CustomMultipartFormDataStreamProvider(string path)
: base(path)
{
}
public override string GetLocalFileName(System.Net.Http.Headers.HttpContentHeaders headers)
{
}
public override Stream GetStream(HttpContent parent, System.Net.Http.Headers.HttpContentHeaders headers)
{
}
}
source
share