DeviceManager/DeviceRepair.Api/Common/DoMultipartFormDataStreamProvider.cs

18 lines
600 B
C#
Raw Permalink Normal View History

2024-05-28 14:36:38 +00:00
using System;
using System.Net.Http;
using System.Net.Http.Headers;
namespace DeviceRepair.Api.Common
{
public class DoMultipartFormDataStreamProvider : MultipartFormDataStreamProvider
{
public DoMultipartFormDataStreamProvider(string rootPath) : base(rootPath) { }
public override string GetLocalFileName(HttpContentHeaders headers)
{
string fileName = headers.ContentDisposition.FileName.Trim('\"');
string newFileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fileName);
return newFileName;
}
}
}