<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="../../../easyui/jquery-1.8.0.min.js"></script>
<script src="../../../Scripts/jquery.form.js"></script>
<script type="text/javascript">
function uploadAndSubmit() {
var form = document.forms["form1"];
if (form["file"].files.length > 0) {
$("#form1").attr("action", "FileHandler.ashx");
$("#form1").ajaxSubmit({
resetForm: true,
timeout: 100000,
dataType: 'json',
type: 'post',
beforeSubmit: function (formData, jqForm, options) {
return true;
},
uploadProgress: function (event, position, total, percentComplete) {
$("#fileProgress").width(percentComplete + '%');
$("#percent")[0].innerHTML = percentComplete + "%";
},
success: function () {
$("#fileProgress").width('100%');
$("#percent")[0].innerHTML = "100%";
},
complete: function (data) {
}
});
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="FileHandler.ashx">
<input type="file" name="file" id="file" οnchange="javascript:uploadAndSubmit();" />
</form>
<div id="fileProgress" style="background-color:#0094ff;height:8px; padding-top:2px;padding-bottom:3px; width:0px; border-radius:2px;">
<span id="percent" style="float:right; font-size:12px;"></span>
</div>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="../../../easyui/jquery-1.8.0.min.js"></script>
<script src="../../../Scripts/jquery.form.js"></script>
<script type="text/javascript">
function uploadAndSubmit() {
var form = document.forms["form1"];
if (form["file"].files.length > 0) {
$("#form1").attr("action", "FileHandler.ashx");
$("#form1").ajaxSubmit({
resetForm: true,
timeout: 100000,
dataType: 'json',
type: 'post',
beforeSubmit: function (formData, jqForm, options) {
return true;
},
uploadProgress: function (event, position, total, percentComplete) {
$("#fileProgress").width(percentComplete + '%');
$("#percent")[0].innerHTML = percentComplete + "%";
},
success: function () {
$("#fileProgress").width('100%');
$("#percent")[0].innerHTML = "100%";
},
complete: function (data) {
}
});
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="FileHandler.ashx">
<input type="file" name="file" id="file" οnchange="javascript:uploadAndSubmit();" />
</form>
<div id="fileProgress" style="background-color:#0094ff;height:8px; padding-top:2px;padding-bottom:3px; width:0px; border-radius:2px;">
<span id="percent" style="float:right; font-size:12px;"></span>
</div>
</body>
</html>