可以在next.js中创建文件上传api吗?(使用 /api 目录)还是我必须在线使用外部第三方服务?网上找不到任何例子。谢谢
当我尝试从请求中读取多部分内容时,我得到一个异常,说明内容可能已被其他组件读取.
if (MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
{
// Used to accumulate all the form url encoded key value pairs in the
// request.
var formAccumulator = new KeyValueAccumulator();
var boundary = Request.GetMultipartBoundary();
var reader = new MultipartReader(boundary, HttpContext.Request.Body);
var section = await reader.ReadNextSectionAsync();
while (section != null)
{
ContentDispositionHeaderValue contentDisposition;
var hasContentDispositionHeader =
ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out contentDisposition);
}
}
Run Code Online (Sandbox Code Playgroud)