I have an issue where seemingly no matter what I do, no matter how many files, no matter if I remove the extraData option and no matter if I use parameters in the controller action the action is never reached (my breakpoint never triggers).
HTML code:
<div id="logoDiv">
<input id="fileInput" name="files" type="file"
data-allowed-file-extensions='["png", "jpg", "jpeg", "tiff"]' multiple/>
</div>
Javascript code:
var plugin = $('#fileInput').fileinput({
showCaption: false,
showPreview: true,
dropZoneEnabled: false,
theme: "fa",
browseClass: "btn btn-ey-upload btn-ey-utility",
removeClass: "btn btn-ey-upload btn-ey-utility",
uploadClass: "btn btn-ey-upload btn-ey-utility",
showClose: false,
uploadAsync: false,
uploadUrl: "/GeneralInterview/UploadLogo",
//uploadExtraData: { id: 1 }
});
Controller code:
[HttpPost]
public JsonResult UploadFile(List<IFormFile> files)
{
List<string> fileNames = new List<string>();
return Json(fileNames)
}
I have tried both as IActionResult and JsonResult as well.
I am really lost as to what is going wrong, any other resources seem to do exactly what I do but it is just not working.
EDIT: Response and request headers
content-length: 0
content-security-policy: default-src 'self'; style-src 'self' fonts.googleapis.com 'unsafe-inline'; font-src 'self' fonts.gstatic.com; script-src 'self' https://ajax.aspnetcdn.com 'nonces-SNIP'; img-src 'self' data:;
date: Fri, 04 Sep 2020 07:26:48 GMT
status: 400
x-content-type-options: nosniff
x-frame-options: DENY
x-powered-by: ASP.NET
x-rate-limit-limit: 7d
x-rate-limit-remaining: 999965
x-rate-limit-reset: 2020-09-11T07:24:01.3268956Z
x-sourcefiles: =?UTF-8?B?QzpcVXNlcnNcR1gyNjRMSFxTb3VyY2VcUmVwb3NcRU9ZLUVZXEVPWVdlYlxHZW5lcmFsSW50ZXJ2aWV3XFVwbG9hZExvZ28=?=
x-xss-protection: 1;mode=block
Request URL: https://localhost:44357/GeneralInterview/UploadLogo
Request Method: POST
Status Code: 400
Remote Address: [::1]:44357
Referrer Policy: no-referrer-when-downgrade
content-length: 0
content-security-policy: default-src 'self'; style-src 'self' fonts.googleapis.com 'unsafe-inline'; font-src 'self' fonts.gstatic.com; script-src 'self' https://ajax.aspnetcdn.com 'nonces-SNIP'; img-src 'self' data:;
date: Fri, 04 Sep 2020 07:26:48 GMT
status: 400
x-content-type-options: nosniff
x-frame-options: DENY
x-powered-by: ASP.NET
x-rate-limit-limit: 7d
x-rate-limit-remaining: 999965
x-rate-limit-reset: 2020-09-11T07:24:01.3268956Z
x-sourcefiles: =?UTF-8?B?QzpcVXNlcnNcR1gyNjRMSFxTb3VyY2VcUmVwb3NcRU9ZLUVZXEVPWVdlYlxHZW5lcmFsSW50ZXJ2aWV3XFVwbG9hZExvZ28=?=
x-xss-protection: 1;mode=block
:authority: localhost:44357
:method: POST
:path: /GeneralInterview/UploadLogo
:scheme: https
accept: application/json, text/javascript, */*; q=0.01
accept-encoding: gzip, deflate, br
accept-language: en-US,en;q=0.9
content-length: 58916
content-type: multipart/form-data; boundary=----WebKitFormBoundaryDm8BfGYWiNAUmPUI
cookie: .AspNetCore.Antiforgery.cookiedata; .AspNetCore.Antiforgery.cookiedata
origin: https://localhost:44357
referer: https://localhost:44357/GeneralInterview/Index/16014
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: same-origin
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36
x-requested-with: XMLHttpRequest
logoFiles: (binary)
logoFiles: (binary)
initialPreview: []
initialPreviewConfig: []
initialPreviewThumbTags: []
Form Data files = logoFiles, I have just changed the name since then.
Thanks in advance.