Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
重构上传组件,前端已经差不多,但是后端报400
Browse files Browse the repository at this point in the history
  • Loading branch information
teacher-zhou committed Jul 31, 2023
1 parent 70b1a41 commit 8e12863
Show file tree
Hide file tree
Showing 12 changed files with 970 additions and 492 deletions.
27 changes: 27 additions & 0 deletions doc/TDesign.Docs.ServerSide/Controllers/UploadController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc;

namespace TDesign.Docs.ServerSide.Controllers;
[ApiController]
[Route("api/[controller]")]
public class UploadController:ControllerBase
{
[HttpPost("file")]
public async Task<IActionResult> PostAsync([FromForm]List<IFormFile> files)
{
//var savedPath = "/upload";
//var generateFileName = Path.Combine(DateTimeOffset.UnixEpoch.ToString(), Path.GetExtension(file.Name));

//if ( !Directory.Exists(savedPath) )
//{
// Directory.CreateDirectory(savedPath);
//}

//var serverFilePath = Path.Combine(savedPath, generateFileName);

//using var fileStream = new FileStream(serverFilePath, FileMode.CreateNew);
//await file.OpenReadStream().CopyToAsync(fileStream);

return Ok();
}
}
307 changes: 204 additions & 103 deletions doc/TDesign.Docs.ServerSide/TDesign.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<Example Title="基础文件上传">
<Description></Description>
<RunContent>
<TUpload/>
<TUpload Action="api/upload/file"/>

</RunContent>
<CodeContent>
@Code.Create(@"
Expand Down
Loading

0 comments on commit 8e12863

Please sign in to comment.