I am very new in asp.net MVC.
There is a input FileUpload button in Index.cshtml page:
Technical Data :
@Html.ListBoxFor(m => m.UISelectTechnicalData, Model.TechnicalDataList, new { @class = "form-control", @id = "lbTDT" }).DisableIf(() => Model.IsActiveSnapShort == true)
<div class="btn btn-default fileinput-button">Browse
<input id="fileupload" type="file" name="files[]" multiple onchange="getfilename(this, 'lbTDT')">
</div>
<script>
function getfilename(id, lstbxId) {
var fn = $(id).val().split(/(\\|\/)/g).pop();
if (fn.length > 95) {
$('#modal-text').html("File name length should be equal or less than 100");
$('#myModal').modal('toggle');
}
else {
var ext1 = $(id).val().split('.').pop().toLowerCase();
if ($.inArray(ext1, ['xlsx']) == -1) {
$('#modal-text').html("only '.xlsx' files are allowed");
$('#myModal').modal('toggle');
}
else {
}
}
}
</script>
when I click on Browse button, I want to compare the path (location from where I am browsing the file to upload) with one of the path set in web config file. If both the path does not match, it shall show a msg in Modal pop-up "Path does not match" and if match then upload file(current functionality).
In web conifg, UploadFile path is as below:
<appSettings>
<add key="FeedfileUploadPath" value="\\163.184.39.243\Merak BPC Integration\bpc\Development Refer Cost Data\Cache Environment\Temp\" />
How can I write the code for the same in above JavaScript function(getfilename), which I am calling on Browse button click ?
Thanks in advance.