initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
$(document).ready(function (e) {
|
||||
$("#form").on('submit', (function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
url: "ajaxupload.php",
|
||||
type: "POST",
|
||||
data: new FormData(this),
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData:false,
|
||||
beforeSend : function() {
|
||||
$("#err").fadeOut();
|
||||
},
|
||||
success: function(data) {
|
||||
if(data == 'invalid') {
|
||||
$("#err").html("Файл с таким расширением запрещенно загружать").fadeIn();
|
||||
} else if(data == 'noUser') {
|
||||
$("#err").html("Вам запрещенно загружать файлы").fadeIn();
|
||||
} else if(data == 'noAcces') {
|
||||
$("#err").html("Вам запрещенно загружать файлы").fadeIn();
|
||||
} else {
|
||||
$("#preview").html(data).fadeIn();
|
||||
$("#form")[0].reset();
|
||||
$("#err").html("Файл загружен").fadeIn();
|
||||
}
|
||||
},
|
||||
error: function(e) {
|
||||
$("#err").html(e).fadeIn();
|
||||
}
|
||||
});
|
||||
}));
|
||||
});
|
||||
Reference in New Issue
Block a user