I'm doing a photo upload system and it bugou! When I add the first photo it will be fine, but if I try to change the photo again it does not do the default action anymore ...
<div id="exibirfoto"><img src="$row[foto]" id="exibirfoto2"><div id="exibirfoto3">ALTERAR FOTO</div></div>
<form action="uploadfoto.php" method="post" enctype="multipart/form-data" id="uploadfotoform">
<input name="uploadfoto" id="uploadfoto" type="file" />
</form>
<script>
$(document).ready(function(event) {
var options = {
success: function(data)
{
alert(data);
}
};
$("#uploadfotoform").ajaxForm(options);
});
$("#exibirfoto3").click(function() {
$("#uploadfoto").click();
});
$("#uploadfoto").change(function() {
var file = $("#uploadfoto").get(0).files[0].name;
$("#uploadfotoform").submit();
$("#exibirfoto").html("<img src='" + file + "' id='exibirfoto2'><div id='exibirfoto3'>ALTERAR FOTO</div>");
});
</script>