@@ -46,8 +46,9 @@ public HttpResponseMessage GetDocumentation()
4646 // 1) Documentation Path
4747
4848 //var filename = "file.pptx";
49- //var filepath = HttpContext.Current.Server.MapPath($"~/App_Data/{filename}");
50- var DocumentationPath = ConfigurationManager . AppSettings [ "DocumentationPath" ] ;
49+ //var DocumentationPath = HttpContext.Current.Server.MapPath($"~/App_Data/{filename}");
50+ var relativePath = ConfigurationManager . AppSettings [ "DocumentationPath" ] ;
51+ var DocumentationPath = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , relativePath ) ;
5152
5253 //Read the File into a Byte Array.
5354 byte [ ] bytes = File . ReadAllBytes ( DocumentationPath ) ;
@@ -93,7 +94,10 @@ public async Task<HttpResponseMessage> Post_File_PInvoke_Return_File()
9394 try
9495 {
9596 //Any size, and extension of a file can be read and uploaded in the Uploaded Folder
96- var fileuploadPath = ConfigurationManager . AppSettings [ "UploadFile" ] ;
97+ //var fileuploadPath = ConfigurationManager.AppSettings["UploadFile"];
98+ var relativePath = ConfigurationManager . AppSettings [ "UploadFile" ] ;
99+ var fileuploadPath = Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , relativePath ) ;
100+
97101
98102 var provider = new MultipartFormDataStreamProvider ( fileuploadPath ) ;
99103 var content = new StreamContent ( HttpContext . Current . Request . GetBufferlessInputStream ( true ) ) ;
@@ -129,8 +133,7 @@ public async Task<HttpResponseMessage> Post_File_PInvoke_Return_File()
129133 //Create HTTP Response.
130134 var response = new HttpResponseMessage ( HttpStatusCode . OK ) ;
131135
132- // 1) Documentation Path
133-
136+ // 1) Uploaded File Path
134137 //Read the File into a Byte Array.
135138 byte [ ] bytes = File . ReadAllBytes ( UploadedFilePath ) ;
136139
0 commit comments