gpt4 book ai didi

asp.net-core - asp.net core 中的 ContentDispositionHeaderValue.FileName 与 IFormFile.FileName

转载 作者:行者123 更新时间:2023-12-04 15:55:52 25 4
gpt4 key购买 nike

互联网上所有关于文件上传的代码都使用 ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName

但我看到 IFormFile 也有一个 FileName

它们之间有什么区别,为什么使用第一种解决方案而不是第二种?

最佳答案

IFormFile 仅在 .NET Core 2 中引入。当您使用 .NET Core 2 或更高版本时,使用 IFormFile 会更方便。但是,如果您使用以前版本的 Asp.net,除了 ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName

之外别无选择

关于asp.net-core - asp.net core 中的 ContentDispositionHeaderValue.FileName 与 IFormFile.FileName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51707788/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com