22 lines
512 B
C#
22 lines
512 B
C#
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);
|
|
}
|
|
} |