Postingan lainnya
Buku Ini Koding!
Baru!
Buku ini akan jadi teman perjalanan kamu belajar sampai dapat kerjaan di dunia programming!
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Upload file ke folder D:upload bisa (di luar localhost ) tapi saat mau diview gak tampil
<?php error_reporting(0)
include 'ceklog.php';
?>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
<head>
<title>Aplikasi Baru</title>
<script src="jquery/jquery.mobile-1.4.5.min.js"></script>
<link rel="stylesheet" type="text/css" href="jquery/jquery.mobile-1.4.5.min.css"></link>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css"></link>
<link rel="stylesheet" type="text/css" href="css/font-awesome.css">
<link rel="stylesheet" type="text/javascript" href="assets/js/bootstrap.js">
<link rel="stylesheet" href="bootstrap.min.css"/>
<script type="text/javascript" src="html5lightbox/jquery.js"></script>
<script type="text/javascript" src="html5lightbox/html5lightbox.js"></script>
<script type="text/javascript">
var html5lightbox_options ={
watermark:"http://html5box.com/images/html5boxlogo.png",
watermarklink:""
};
</script>
<style type="text/css">
#html5-watermark{
position: absolute !important;
top: auto !important;
left: auto !important;
right: 0px !important;
bottom: 0px !important;
}
</style>
<style>
#wrapper{min-height:100%;position:relative;}
#body{background-color:#999999; padding-bottom:40px;padding-left:10px;}
#footer{background-color:#000000;position:absolute;bottom:0;width:100%;height:50px;
text-align:center;color:#FFFFFF;}
</style>
<ul class="nav nav-tabs" style="background-color:#333333">
<li class="nav-item">
<a class="nav-link active" href="data">Data</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="logout">Log Out</a>
</li>
</li>
</ul>
</head>
<body>
<?php
// includekan fungsi paginasi
include 'pagination1.php';
include 'koneksi.php';
// mengatur variabel reload dan sql
if(isset($_REQUEST['keyword']) && $_REQUEST['keyword']<>""){
// jika ada kata kunci pencarian (artinya form pencarian disubmit dan tidak kosong)
// pakai ini
$keyword=$_REQUEST['keyword'];
$reload = "home?pagination=true&keyword=$keyword";
$sql = "SELECT * from ltoo where nama like '%$keyword%' or kaset like '%$keyword%' or deskripsi like '%$keyword%' ORDER BY id DESC";
$result = mysql_query($sql);
}else{
// jika tidak ada pencarian pakai ini
$reload = "home?pagination=true";
$sql = "SELECT * FROM ltoo where id ORDER BY id DESC";
$result = mysql_query($sql);
}
//pagination config start
$rpp = 100; // jumlah record per halaman
$page = intval($_GET["page"]);
if($page<=0) $page = 1;
$tcount = mysql_num_rows($result);
$tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number
$count = 0;
$i = ($page-1)*$rpp;
$no_urut = ($page-1)*$rpp;
//pagination config end
?>
<div class="ui-body ui-bar-a ui-corner-all style="margin-top: 50px">
<div class="row">
<div class="col-lg-8">
<!--muncul jika ada pencarian (tombol reset pencarian)-->
<?php
if($_REQUEST['keyword']<>""){
?>
<a class="btn btn-default btn-outline" href="home"> Reset Pencarian</a>
<?php
}
?>
</div>
<div class="col-lg-4 text-right">
<form method="post" action="home">
<div class="form-group input-group">
<input type="text" style="color:#000000;" name="keyword" class="form-control" placeholder="Search..." value="<?php echo $_REQUEST['keyword']; ?>">
<span class="input-group-btn">
<button class="btn btn-primary" type="submit">Cari
</button>
</span>
</div>
</form>
</div>
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>#</th>
<th>No Kaset</th>
<th>Nama File</th>
<th>Deskripsi</th>
<th>Tahun</th>
<th>Preview File</th>
</tr>
</thead>
<tbody>
<?php
while(($count<$rpp) && ($i<$tcount)) {
mysql_data_seek($result,$i);
$data = mysql_fetch_array($result);
?>
<tr>
<td width="50px">
<?php echo ++$no_urut;?>
</td>
<td width="120px">
<?php echo $data ['kaset']; ?>
</td>
<td width="450px">
<?php echo $data ['nama']; ?>
</td>
<td>
<?php echo $data ['deskripsi']; ?>
</td>
<td width="30px">
<?php echo $data ['tahun']; ?>
</td>
<td width="110px">
<a href="D:/upload/<?php echo $data ['file']; ?>" class="html5lightbox" data-group="mygroup" data-widt="380" data-hihgt="220"><img src="gambar/prev.png" width="35" height="35"></a>
</td>
</tr>
<?php
$i++;
$count++;
}
?>
</tbody>
</table>
<div><?php echo paginate_one($reload, $page, $tpages); ?></div>
</div>
</body>
</html>
4 Jawaban:
ini mau bikin mode aplikasinya hanya berjalan di localhost aja?
lagian situ pake <pre> <a href="D:/upload/<?php echo $data ['file']; ?>" </pre> ini kan buat hyperlink, kalau mau manggil image itu pake tag <pre> <img scr="letak file image" /> </pre>
Filenya Video Gan., trus di panggil dari db dan datanya ada di drive itu
<pre> <a href="D:/upload/<?php echo $data ['file']; ?>" </pre>
iya ngerti gan, kalau mau panggil tampilan video ini contoh html code nya
<pre> <video width="320" height="240" controls> <source src="movie.mp4" type="video/mp4"> <source src="movie.ogg" type="video/ogg"> Your browser does not support the video tag. </video> </pre>
sumber nya : <a href=' https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video '> https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_video </a>
Kalau mau bisa akses file di drive lain, agan harus modifikasi xampp agan.
- Add folder name "alias" in :
<pre> C:\xampp\apache\conf\ </pre>
- After adding alias folder add this in "httpd.conf" at the bottom and save it.
<pre> Include "conf/alias/*" </pre>
- Now create *alias.conf" and save it to alias folder:
<pre> <directory "c:\TEST"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named explicitly --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks Includes ExecCGI
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
# Order allow,deny
Allow from all
</Directory>
Alias /test "C:\TEST" </pre>
Thankz gan infonya., ane baru mo coba lagi ni projec