This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DONE: Get the HTML Form as a Stream: 1st method: if we want to download the HTML as file... | |
// Set the response to "HttpResponseMessage" in order to allow the user to download the file through his browser | |
var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(stream) }; | |
result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); | |
result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment") { FileName = "ATTUNITY-LOGON.TXT" }; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// DONE: PICK UP FILES FROM "UPLOADS_TEMP_DIR" AND UPLOAD THEM TO ATTUNITY | |
/// TODO: SHOULD MOVE THIS METHOD TO "DLSFileUtils" CLASS. | |
/// </summary> | |
/// <param name="applicationId"></param> | |
/// <returns></returns> | |
public void UploadFilesToAttunity(string applicationId) | |
{ | |
// DONE: "UPLOADS_TEMP_DIR" IN SystemConfiguration TABLE - "SystemConfiguration.getConfigValue("UPLOADS_TEMP_DIR", true)" - "C:/SERVER_FILES/" | |
string basePath = SystemConfiguration.getConfigValue("UPLOADS_TEMP_DIR", true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public async Task<IHttpActionResult> UploadFile() | |
{ | |
try | |
{ | |
if (!Request.Content.IsMimeMultipartContent()) | |
Request.CreateResponse(HttpStatusCode.UnsupportedMediaType); | |
#region PREVIOUS CODE - UPLOADS THE FILES TO A SERVER-SIDE DIRECTORY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Security; | |
using System.Security.Cryptography; | |
using System.Text; | |
namespace DLSJobScheduler.BusinessLogic | |
{ | |
class Cryptography | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region TEST "Request.Content.ReadAsStreamAsync()" | |
var provider = new MultipartMemoryStreamProvider(); | |
await Request.Content.ReadAsMultipartAsync(provider); | |
foreach (var item in provider.Contents.Where(item => item.Headers.ContentDisposition.FileName != null)) | |
{ | |
Stream streamRead = await item.ReadAsStreamAsync(); |