This commit is contained in:
@@ -165,11 +165,11 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
//used to hold extra file data sent by client
|
||||
public class fileData
|
||||
{
|
||||
public string name { get; set; }
|
||||
public long lastModified { get; set; }
|
||||
}
|
||||
// public class UploadFileData
|
||||
// {
|
||||
// public string name { get; set; }
|
||||
// public long lastModified { get; set; }
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Upload attachment file
|
||||
@@ -197,14 +197,14 @@ namespace AyaNova.Api.Controllers
|
||||
if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType))
|
||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.INVALID_OPERATION, "FileUploadAttempt", $"Expected a multipart request, but got {Request.ContentType}"));
|
||||
|
||||
var uploadFormData = await ApiUploadProcessor.ProcessAttachmentUploadAsync(HttpContext);
|
||||
var uploadFormData = await ApiUploadProcessor.ProcessUploadAsync(HttpContext);
|
||||
|
||||
bool badRequest = false;
|
||||
string AttachToObjectType = string.Empty;
|
||||
string AttachToObjectId = string.Empty;
|
||||
string errorMessage = string.Empty;
|
||||
string Notes = string.Empty;
|
||||
List<fileData> FileData = new List<fileData>();
|
||||
List<UploadFileData> FileData = new List<UploadFileData>();
|
||||
|
||||
if (
|
||||
!uploadFormData.FormFieldData.ContainsKey("FileData") ||
|
||||
@@ -222,7 +222,7 @@ namespace AyaNova.Api.Controllers
|
||||
Notes = uploadFormData.FormFieldData["Notes"].ToString();
|
||||
//fileData in JSON stringify format which contains the actual last modified dates etc
|
||||
//"[{\"name\":\"Client.csv\",\"lastModified\":1582822079618},{\"name\":\"wmi4fu06nrs41.jpg\",\"lastModified\":1586900220990}]"
|
||||
FileData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<fileData>>(uploadFormData.FormFieldData["FileData"].ToString());
|
||||
FileData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UploadFileData>>(uploadFormData.FormFieldData["FileData"].ToString());
|
||||
|
||||
if (string.IsNullOrWhiteSpace(AttachToObjectType) || string.IsNullOrWhiteSpace(AttachToObjectId))
|
||||
{
|
||||
@@ -298,7 +298,7 @@ namespace AyaNova.Api.Controllers
|
||||
//Get the actual date from the separate filedata
|
||||
//this is because the lastModified date is always empty in the form data files
|
||||
DateTime theDate = DateTime.MinValue;
|
||||
foreach (fileData f in FileData)
|
||||
foreach (UploadFileData f in FileData)
|
||||
{
|
||||
if (f.name == a.OriginalFileName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user