I am using the below file upload control and script
function is
1. when user browser image it quickly showing the preview in dvpreview
2. i want before uploading the image user in dvpreview it should have button to rotate the images before uploading
so any horizontal image before upload user can correct it
rotate meant horizontal images can be rotate to vertical like flip90 degree on each click
<asp:FileUpload ID="fuicon" runat="server" accept="image/*" />
<div id="dvPreview" runat="server" visible="false">
</div>
<script language="javascript" type="text/javascript">
$(function () {
$('[id*=fuUpload1]').change(function () {
if (typeof (FileReader) != "undefined") {
var dvPreview = $("#dvPreview");
dvPreview.html("");
var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.jpg|.jpeg|.gif|.png|.bmp)$/;
$($(this)[0].files).each(function () {
var file = $(this);
if (regex.test(file[0].name.toLowerCase())) {
var reader = new FileReader();
reader.onload = function (e) {
var img = $("<img />");
img.attr("style", " ");
img.attr("src", e.target.result);
dvPreview.append(img);
}
reader.readAsDataURL(file[0]);
} else {
alert(file[0].name + " is not a valid image file.");
dvPreview.html("");
return false;
}
});
} else {
alert("This browser does not support HTML5 FileReader.");
}
});
});
</script>