我写了一个方法来使用返回类型返回一个文件HttpResposeMessage
。我使用下面的代码来附加文件。
file.Content.Headers.ContentDisposition =
new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
{
FileName = newFileName
};
file.Content.Headers.ContentType =
new MediaTypeHeaderValue("application/octet-stream");
return file;
如何在文件名中指定特定路径。我做了这样的事情
fileName = "C://Templates/Order.pdf"
但这会将文件名重命名为C:_Templates_Order.pdf
我需要的是通过路径并获取文件。