Initial
This commit is contained in:
22
PdfMarker/Services/PdfStorageService.cs
Normal file
22
PdfMarker/Services/PdfStorageService.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace PdfMarker.Services;
|
||||
|
||||
public class PdfStorageService
|
||||
{
|
||||
private readonly IWebHostEnvironment _env;
|
||||
|
||||
public PdfStorageService(IWebHostEnvironment env)
|
||||
{
|
||||
_env = env;
|
||||
}
|
||||
|
||||
public async Task SaveAsync(IFormFile file)
|
||||
{
|
||||
var path = Path.Combine(_env.WebRootPath, "pdf");
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
var filePath = Path.Combine(path, file.FileName);
|
||||
|
||||
using var stream = File.Create(filePath);
|
||||
await file.CopyToAsync(stream);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user