Hi friends,
I have a partial view where in user can upload a file. following is my code
Partial View:
@model UploadeRateModel
@Html.ValidationSummary(true)
<iframe id="uploadTrg" name="uploadTrg" height="0" width="0" frameborder="0" scrolling="yes" style="display:none;"></iframe>
@using (Html.BeginForm("UploadExchangeRate", "ExchangeRates", FormMethod.Post, new { @id = "UploadRateForm", @enctype = "multipart/form-data", @target = "uploadTrg" }))
{
<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
<script>
$(document).ready(function () {
$('input[id=lefile]').change(function () {
$('#photoCover').val($(this).val());
});
});
</script>
<div id="UploadSheet_Div" style="margin-removed20px;margin-removed8px;">
<div class="input-group" style="width:100%;">
@Html.LabelFor(m => m.File, "Upload Rate Sheet- using Supply Rate File Name*", new { @style = "color: #002663;width:216px;display:inline-block;" })
<span class="input-group" style="display:inline-block;">
@Html.TextBoxFor(m => m.File, new { @id = "lefile", @type = "file", @style = "display:none;" })
@Html.TextBox("File", null, new { @id = "photoCover", @class = "input-large", @type = "text", @style = "border-radius:5px;margin-left:60px;vertical-align:top;" })
<a class="btn" >Browse</a>
@Html.ValidationMessageFor(m => m.File)
</span>
</div>
</div>
<div style="margin-removed21px;margin-removed20px;">
<button id="btnUpload" type="submit" style="color: white; display: inline-block;background: #00693C;border: antiquewhite;border-radius: 3px;margin-left: 235px;padding: 8px;margin-right: 1px;">Upload</button>
</div>
Javascript Code:
$(document).on("submit", "#UploadRateForm", function () {
$('#btnUpload').attr('disabled', 'disabled');
$("#uploadTrg").unbind('load');
$("#uploadTrg").load(function () {
var stringContent = $(this).contents().find("pre").html();
var objJson = jQuery.parseJSON(stringContent);
var SplittedValue = objJson.split(",");
if (SplittedValue != null) {
if (SplittedValue[0] == "true" || SplittedValue[0] == "True") {
ExRateSheetableLoad(SplittedValue[1], "P");
$('#SupplyDescText').val(SplittedValue[2])
$("#UploadSheetShowDiv").slideDown("slow");
$("#UploadSuccessMsg_Div").slideDown("slow");
}
else if (SplittedValue[0] == "false" || SplittedValue[0] == "False") {
$('#UploadErrorDiv').show();
$('#lblUpload_Errormsg').text(SplittedValue[1]);
}
}
$('#btnUpload').removeAttr('disabled', 'disabled');
});
});
$(document).on('click', "#btnUpload", function () {
var form = $('#UploadRateForm');
$("#RatesheetTable_Div").html('');
$("#UploadSuccessMsg_Div").hide();
$("#btnUpload").addClass("disabled");
$('#UploadErrorDiv').slideUp();
form.submit();
return false;
});
When I try to submit the form using JavaScript, it gives me Access Denied error for IE. It works fine for rest browser.
Can anyone tell me is there is security issue when it comes to file uploading in IE?
What can be the solution for the issue?
Thanks in advance