file limitation

This commit is contained in:
gayathri1990 2018-04-12 13:15:53 +05:30
parent 759a9c92b9
commit 7aa593f0e4
3 changed files with 42 additions and 13 deletions

View File

@ -39,7 +39,15 @@ $('#towhom').text('Received From:');
function readURL(input) { function readURL(input) {
var sizeof = document.getElementById('file').files[0].size;
if(sizeof > 2100000){
alert('Sorry Your File is Large To 2MB');
$('#file').val('');
//window.location.reload();
}else {
alert('Your file added successfully');
}
if (input.files && input.files[0]) { if (input.files && input.files[0]) {
var reader = new FileReader(); var reader = new FileReader();
@ -352,6 +360,8 @@ function loadAccountType(id)
function validate() function validate()
{ {
var accode = $('#accode').val(); var accode = $('#accode').val();
var date = $('#Date').val(); var date = $('#Date').val();
var towhome = $('#towhome').val(); var towhome = $('#towhome').val();

View File

@ -3110,7 +3110,7 @@ function populateValueMainFormForDeleteItem(rowid)
<div class="col-md-12"> <div class="col-md-12">
<div class="col-md-5"> <div class="col-md-5">
<input type = "file" size = "20" input accept=".docx,.pdf,.doc.JPG,.PNG" id="imag" name="images" onChange="filecheck();"/> <input type = "file" size = "20" input accept=".docx,.pdf,.doc.JPG,.PNG,.jpg" id="imag" name="images" onChange="filecheck();"/>
<label for="images">Select file<br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label> <label for="images">Select file<br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
</div> </div>
@ -3175,7 +3175,7 @@ function populateValueMainFormForDeleteItem(rowid)
<div class="col-md-4"> <div class="col-md-4">
<input type = "file" size = "20" input accept=".docx,.pdx,.doc.JPG,.PNG" id="images1" name="images1" onChange="sfilecheck();"/> <input type = "file" size = "20" input accept=".docx,.pdx,.doc.JPG,.PNG,.jpg" id="images1" name="images1" onChange="sfilecheck();"/>
<label for="images">Select Company file<br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label> <label for="images">Select Company file<br/><small>(only .pdf,.excel,.doc,.png,.jpg)</small></label>
</div> </div>
@ -8690,24 +8690,36 @@ var specialservicerow=0;
{ {
//$('#content').loader('show'); //$('#content').loader('show');
var sizef = document.getElementById('imag').files[0].size;
var file = $('#imag').val(); var file = $('#imag').val();
alert(file); //alert(file);
if(file!='') if(file!='' && sizef < 2100000)
{ {
alert('Your file added successfully'); alert('Your file added successfully');
} }
else
{
alert('Sorry Your File is Large To 2MB');
$('#imag').val('');
}
} }
function sfilecheck() function sfilecheck()
{ {
//$('#content').loader('show'); //$('#content').loader('show');
var sizef = document.getElementById('images1').files[0].size;
var file1 = $('#images1').val(); var file1 = $('#images1').val();
if(file1!='') if(file1!='' && sizef < 2100000)
{ {
alert('Your file added successfully'); alert('Your file added successfully');
} }
else
{
alert('Sorry Your File is Large To 2MB');
$('#images1').val('');
}
} }
</script> </script>

View File

@ -493,7 +493,7 @@ $('<input>').attr({
}); });
if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>')) if((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>') && ostatus != '<?php echo OGR_CREATED; ?>' )
{ {
alert('The Order is completed!!'); alert('The Order is completed!!');
$("#IGRLink").hide(); $("#IGRLink").hide();
@ -626,10 +626,17 @@ function filecheck()
} }
function filealert() function filealert()
{ {
var myfile = $('#myfile').val(); var sizef = document.getElementById('myfile').files[0].size;
if(myfile!='') var myfile = $('#myfile').val();
if(myfile!='' && sizef < 2100000)
{
alert('Your file added successfully');
}
else
{ {
alert('Your file added successfully'); alert('Sorry Your File is Large To 2MB');
$('#myfile').val('');
} }
} }