Commit 037d2797 authored by Guilherme Silva's avatar Guilherme Silva
Browse files

Validação no recebimento de arquivo ao criar edital

parent 8bb7c2c0
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
<a id="pdfEditalTemp" href="{{ route('baixar.evento.temp', ['nomeAnexo' => 'pdfEdital' ])}}">Arquivo atual</a> <a id="pdfEditalTemp" href="{{ route('baixar.evento.temp', ['nomeAnexo' => 'pdfEdital' ])}}">Arquivo atual</a>
@endif @endif
<input type="hidden" id="pdfEditalPreenchido" name="pdfEditalPreenchido" value="{{ old('pdfEditalPreenchido') }}" > <input type="hidden" id="pdfEditalPreenchido" name="pdfEditalPreenchido" value="{{ old('pdfEditalPreenchido') }}" >
<input type="file" class="form-control-file @error('pdfEdital') is-invalid @enderror" name="pdfEdital" value="{{ old('pdfEdital') }}" id="pdfEdital" onchange="exibirAnexoTemp(this)"> <input type="file" accept=".pdf" class="form-control-file pdf @error('pdfEdital') is-invalid @enderror" name="pdfEdital" value="{{ old('pdfEdital') }}" id="pdfEdital" onchange="exibirAnexoTemp(this)">
<small>O arquivo selecionado deve ser no formato PDF de até 2mb.</small> <small>O arquivo selecionado deve ser no formato PDF de até 2mb.</small>
@error('pdfEdital') @error('pdfEdital')
<span class="invalid-feedback" role="alert"> <span class="invalid-feedback" role="alert">
...@@ -293,5 +293,26 @@ ...@@ -293,5 +293,26 @@
modeloDocumentoPreenchido.value = "sim"; modeloDocumentoPreenchido.value = "sim";
} }
} }
$("input[type='file']").on("change", function () {
if(this.files[0].size > 2000000) {
// console.log($(this).parents( ".col-sm-5" ))
alert("O tamanho do arquivo deve ser menor que 2MB!");
$(this).val('');
}
});
$("input.pdf").on("change", function () {
if(this.files[0].type.split('/')[1] == "pdf") {
if(this.files[0].size > 20000000){
alert("O arquivo possui o tamanho superior a 2MB!");
$(this).val('');
}
}else{
alert("O arquivo não é de tipo PDF!");
$(this).val('');
}
});
</script> </script>
@endsection @endsection
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment