Try to upload a file to a web api and save it, When run the project locally with IIS it succeed to save the file with Chrome And IE11.
When i deploy the Project to the Test Env when try to save: With Chrome i get 'Acces is denied' With IE it's working.
How to make it work with Chrome as well?
Client Code:
var data = new FormData();
var files = $("#fileUpload").get(0).files;
// Add the uploaded image content to the form data collection
if (files.length > 0) {
data.append("UploadedImage", files[0]);
}
// Make Ajax request with the contentType = false, and procesDate = false
$.ajax({
type: "POST",
url: uriUser + "/UploadFile",
contentType: false,
processData: false,
data: data,
success: function (data) {
try {
showMsg(MessageType.Info, data);
closeWin();
}
catch (e) {
if (e.message == "") {
showMsg(MessageType.Error, msg_error);
}
}
},
error: function (response) {
console.error('DeleteRole failed :' + response);
}
});
Server Code:
var httpPostedFile = HttpContext.Current.Request.Files["UploadedImage"];
// Some manipulation to get the FileName and the Path...
httpPostedFile.SaveAs(fileSavePath);