Пытаюсь удалить изображение с превью оно чиститься в классе но на сервер попадает вот пример
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#image').attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
$("#photo").change(function() {
readURL(this);
});
$('#delete').click(function() {
$('#image').remove(); // Удаляем превью
});
$("#multiform").submit(function(e) {
var formObj = $(this);
var formURL = formObj.attr("action");
if (window.FormData !== undefined) // for HTML5 browsers
{
var formData = new FormData(this);
$.ajax({
url: formURL,
type: "POST",
data: formData,
mimeType: "multipart/form-data",
contentType: false,
cache: false,
processData: false,
success: function(data, textStatus, jqXHR) {
alert('rtrth');
},
error: function(jqXHR, textStatus, errorThrown) {
alert('1111');
}
});
e.preventDefault();
}
});
.input-file-row-1:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.input-file-row-1 {
display: inline-block;
margin-top: 25px;
position: relative;
}
html[xmlns] .input-file-row-1 {
display: block;
}
* html .input-file-row-1 {
height: 1%;
}
.upload-file-container {
position: relative;
width: 100px;
height: 137px;
overflow: hidden;
background: url(http://i.imgur.com/AeUEdJb.png) top center no-repeat;
float: left;
margin-left: 23px;
}
.upload-file-container:first-child {
margin-left: 0;
}
.upload-file-container > img {
width: 93px;
height: 93px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
.upload-file-container-text {
font-family: Arial, sans-serif;
font-size: 12px;
color: #719d2b;
line-height: 17px;
text-align: center;
display: block;
position: absolute;
left: 0;
bottom: 0;
width: 100px;
height: 35px;
}
.upload-file-container-text > span {
border-bottom: 1px solid #719d2b;
cursor: pointer;
}
.upload-file-container input {
position: absolute;
left: 0;
bottom: 0;
font-size: 1px;
opacity: 0;
filter: alpha(opacity=0);
margin: 0;
padding: 0;
border: none;
width: 70px;
height: 50px;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form name="multiform" id="multiform" action="multi-form-submit.php" method="POST" enctype="multipart/form-data">
Name:
<input type="text" name="name" value="" />
<br/>Age :
<input type="text" name="age" value="" />
<br/>Image :
<input type="file" id="photo" class="photo" name="photo" />
<br/>
<button class="btn btn-info" id="multi-post">Run Code</button>
</form>
<img id="image" src="#" alt="" />
<div id="delete">delete</div>