0
Привет, можно проверить, есть ли тип входного файла в нем перед запуском функции. Мне нужно как-то отключить кнопку отправки, если пользователь не вводит файл.Требовать ввода файла для хранения файла в
<script>
$(function() {
var bar = $('.progress-bar');
var percent = $('.percent');
var status = $('#status');
$('#uploaderForm').ajaxForm({
beforeSend: function() {
status.empty();
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
$("#progressBar").removeClass('disappear').addClass('appear');
$("#submitFileUpload").addClass('disappear');
},
uploadProgress: function(event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
//console.log(percentVal, position, total);
},
success: function() {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
},
complete: function() {
$("#status").text("Great, your upload was completed successfully.").removeClass('disappear');
$("#progressBar").removeClass('appear').addClass('disappear');
setTimeout(function() {
window.location.href = "/thanks";
}, 2000);
},
});
})();
</script>
вам мой друг является спасателем жизни! Не могу поблагодарить вас. –