perbaikan validasi upload file, gambar, dan validasi show gambar dan file pada kirim surat

This commit is contained in:
nana4895
2024-06-06 15:46:00 +07:00
parent b900ac8292
commit 754b51f502
28 changed files with 1486 additions and 1122 deletions
+45 -39
View File
@@ -1,51 +1,57 @@
<?php
include("../koneksi.php");
$surat_id=$_POST['id'];
<?php
include("../koneksi.php");
$surat_id = $_POST['id'];
?>
<!--
<div class="row port">
<div class="portfolioContainer"> -->
<?php
$dok=pg_query("SELECT * FROM scan WHERE surat_id='$surat_id' AND LOWER(file) LIKE '%jpg' ORDER BY id DESC");
while($rdok=pg_fetch_array($dok)) {$foto=$rdok['file'];$file_id=$rdok['id'];
?>
<div class="row">
<div class="col-lg-12">
<button type="button" id="<?php echo $file_id; ?>" class="btn btn-block btn-success waves-effect waves-light pr_scan_surat">Print</button>
</div>
</div>
<br>
<?php
$dok = pg_query($koneksi,"SELECT * FROM scan WHERE surat_id='$surat_id'
AND LOWER(file) NOT IN ('%.jpg', '%.jpeg', '%.png')
ORDER BY id DESC
");
while ($rdok = pg_fetch_array($dok)) {
$foto = $rdok['file'];
$file_id = $rdok['id'];
?>
<div class="row">
<div class="col-lg-12">
<!-- <div class="gal-detail"> -->
<img name="pic" id="<?php echo $rdok['id']; ?>" src="<?php echo 'app/kirim/dok/'.$foto; ?>" class="img-thumbnail" alt="work-thumbnail">
<!-- </div> -->
</div>
<div class="col-lg-12">
<button type="button" id="<?php echo $file_id; ?>" class="btn btn-block btn-success waves-effect waves-light pr_scan_surat">Print</button>
</div>
</div>
<hr>
<?php
}
?>
<!--
<br>
<div class="row">
<div class="col-lg-12">
<!-- <div class="gal-detail"> -->
<center><img name="pic" id="<?php echo $rdok['id']; ?>" src="<?php echo 'app/kirim/dok/' . $foto; ?>" class="img-thumbnail" alt="work-thumbnail"></center>
<!-- </div> -->
</div>
</div>
<hr>
<?php
}
?>
<!--
</div>
</div> -->
<script>
$('.pr_scan_surat').click(function(){
var id = $(this).attr('id');
var w = 1000;
var h = 800;
var left = Number((screen.width/2)-(w/2));
var tops = Number((screen.height/2)-(h/2));
$.post('app/inbox/print_pic.php', { id : id}, function (result) {
WinId = window.open('toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+tops+', left='+left);
WinId.document.open();
WinId.document.write(result);
WinId.document.close();
WinId.focus();
});
$('.pr_scan_surat').click(function() {
var id = $(this).attr('id');
var w = 1000;
var h = 800;
var left = Number((screen.width / 2) - (w / 2));
var tops = Number((screen.height / 2) - (h / 2));
$.post('app/inbox/print_pic.php', {
id: id
}, function(result) {
WinId = window.open('toolbar=no, location=no, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + tops + ', left=' + left);
WinId.document.open();
WinId.document.write(result);
WinId.document.close();
WinId.focus();
});
});
</script>