mysql - upload and show(select) video in php -


i make form through can upload images , videos, file's stor in folder , path stored in mysql table, when select image file show properly, image selection code is...

$smt=$conn->prepare('select * post'); $smt->execute();  <?php while($gdata=$smt->fetch(pdo::fetch_obj)):?>         <a href="#" class="media-left col-md-4 clearfix"><img src="posts/<?php echo  $gdata->post_path; ?>" alt="image" class="post-image"/></a>         <div class="media-body col-md-8 post-image-space pull-left">             <div class="post-overview">                 <ul>                     <li class="post-category"><?php echo $gdata->category;?></li>                     <li class="post-timestemp">post on <?php echo $gdata->post_date;?></li>                 </ul>               <a href="post-description.php?id=<?php echo $gdata->id?>"><h4 class="media-heading h4"><?php echo $gdata->title;?></h4></a>             <p class="post-text"><?php echo $gdata->post;?></p>           </div>   </div> <?php endwhile;?> 

now problem through above way can access video file can't shown? how can check file image or video?

in database path store like, example.jpg/mypic.png, test.mp4, how can check last extension of file?

my updated code is...

<?php include 'conn.php'; $smt=$conn->prepare('select * post'); $smt->execute(); $row=$smt->fetch(pdo::fetch_obj); $row->post_path; $ext=pathinfo($row,pathinfo_extension);  ?>  <?php if($ext=='mp4')  {?>      <?php while($gdata=$smt->fetch(pdo::fetch_obj)):?>     <a href="#" class="media-left col-md-4 clearfix"><video class="post-image" controls>             <source src="posts/<?php echo $gdata->$ext;?>" type="video/mp4">         </video></a>     <div class="media-body col-md-8 post-image-space pull-left">         <div class="post-overview">             <ul>                 <li class="post-category"><?php echo $gdata->category;?></li>                 <li class="post-timestemp">post on <?php echo $gdata->post_date;?></li>             </ul>               <a href="post-description.php?id=<?php echo $gdata->id?>"><h4 class="media-heading h4"><?php echo $gdata->title;?></h4></a>             <p class="post-text"><?php echo $gdata->post;?></p>         </div>       </div>     <?php endwhile; }  elseif($ext=='jpg||jpeg||png') {      ?>      <?php while ($gdata = $smt->fetch(pdo::fetch_obj)): ?>         <a href="#" class="media-left col-md-4 clearfix"><img src="posts/<?php echo $gdata->post_path; ?>" alt="image"                                                               class="post-image"/></a>         <div class="media-body col-md-8 post-image-space pull-left">             <div class="post-overview">                 <ul>                     <li class="post-category"><?php echo $gdata->category; ?></li>                     <li class="post-timestemp">post on <?php echo $gdata->post_date; ?></li>                 </ul>                   <a href="post-description.php?id=<?php echo $gdata->id ?>"><h4                         class="media-heading h4"><?php echo $gdata->title; ?></h4></a>                  <p class="post-text"><?php echo $gdata->post; ?></p>             </div>           </div>      <?php endwhile; }?> 

i not able show video in index page, how show it, able show image..

any appreciated.

$info = new splfileinfo('testing.jpg'); var_dump($info->getextension()); 

reference

before comes in , says requires installations

this extension available , compiled default in php 5.0.0.

reference


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -