hello,
i am using this to upload file, it works well the only problem is
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$("body").on("click", "#btnUpload", function () {
$.ajax({
//url: '../inbox/Handler.ashx',
url: '<%= ResolveUrl("~/inbox/Handler.ashx")%>' + "?msg=" + $('[id*=txtmsg]').val() + "&chatid="+$('[id*=hdnchatid]').val() ,
type: 'POST',
data: new FormData($('form')[0]),
cache: false,
contentType: false,
processData: false,
success: function (file) {
$("#fileProgress").hide();
$("#lblMessage").html("");
$('[id*=txtmsg]').val("");
$("input[type='file']").val("");
document.getElementById("btncancel").style.display="none";
},
xhr: function () {
var fileXhr = $.ajaxSettings.xhr();
if (fileXhr.upload) {
$("progress").show();
fileXhr.upload.addEventListener("progress", function (e) {
if (e.lengthComputable) {
$("#fileProgress").attr({
value: e.loaded,
max: e.total,
});
}
}, false);
}
return fileXhr;
}
});
});
});
</script>
i already have .js version 1.10.2 so adding below script again make conflict but when i remove the below version of script the above solution of uploading file works
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
but after successful upload this part does not fire
success: function (file) {
$("#fileProgress").hide();
$("#lblMessage").html("");
$('[id*=txtmsg]').val("");
$("input[type='file']").val("");
document.getElementById("btncancel").style.display="none";
},