![]() ![]() I have a Utilities class that upon receipt of the file it makes a copy of the file to the folder where it should stay and deletes the file inside the Files / Uploads folder. The way I'm doing now is a little bureaucratic but it works. I am saving the files in a Files / Uploads folder however, I need to save the files that are received in separate folders, for example Word into a folder named Word etc. ![]() Public override string GetLocalFileName(HttpContentHeaders headers) Public CustomMultipartFormDataStreamProvider(string path) My method: CustomMultipartFormDataStreamProvider public class CustomMultipartFormDataStreamProvider : MultipartFormDataStreamProvider Return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, e) Return Request.CreateResponse(HttpStatusCode.OK, files) Ler conteúdo da requisição para CustomMultipartFormDataStreamProvider.Īwait (provider) įoreach (MultipartFileData file in provider.FileData)įiles.Add(Path.GetFileName(file.LocalFileName)) String fileSaveLocation = ("~/Arquivos/Uploads") ĬustomMultipartFormDataStreamProvider provider = new CustomMultipartFormDataStreamProvider(fileSaveLocation) Preparar CustomMultipartFormDataStreamProvider para carga de dados Throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType) I have a WEB API that receives a file via POST it follows the Controller code: public async Task Post()
0 Comments
Leave a Reply. |