This repository has been archived by the owner on Jan 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,539 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ name: Git Version | |
on: | ||
push: | ||
branches: | ||
- master | ||
- [main] | ||
|
||
jobs: | ||
lint: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
doc/TDesign.Docs.ServerSide/Controllers/UploadController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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] IFormCollection form) | ||
{ | ||
var savedPath = Path.Combine(Directory.GetCurrentDirectory(), "upload"); | ||
|
||
if ( !Directory.Exists(savedPath) ) | ||
{ | ||
Directory.CreateDirectory(savedPath); | ||
} | ||
|
||
foreach ( var file in form.Files ) | ||
{ | ||
var generateFileName = string.Concat(DateTimeOffset.Now.ToString("yyyyMMddHHmmssfff"), Path.GetExtension(file.FileName)); | ||
var serverFilePath = Path.Combine(savedPath, generateFileName); | ||
|
||
using var fileStream = new FileStream(serverFilePath, FileMode.CreateNew); | ||
await file.OpenReadStream().CopyToAsync(fileStream); | ||
} | ||
|
||
return Ok(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.