How to File Upload in Database using PHP


Follow below steps:
HTML Code:
file.php
<html>
<head>
<title>File Upload</title>
<form method="post" enctype="multipart/form-data" action="upload.php">
<input class="tbl2" type="file" name="f"><span class="txt1">(Type : .jp/* /* eg, .jpg, .gif, .png)</span>
<input class="butt2 bt" type="submit" value="save" name="save">
</form>
</body>
</html>
PHP Code:
upload.php
<?php
include('db.php');
if(!empty($_REQUEST['save']))
 {
  
  
  $st2=1;
  $filename=$_FILES['f']['name'];
  $filepath=$_FILES['f']['tmp_name'];
  $ext=end(explode('.',$filename));
  $query="show table status like 'product'";
  
  
  $fullfilename=$id.".".$ext;
  
  
  {
   $query="insert into product(filename) values('$fullfilename')";
  }
?>
db.php
<?php
mysql_connect('localhost', 'root', '');
mysql_select_db('database');
?>
Read full article

Comments

Popular posts from this blog

Student Result Management System

What Is The Job Role Of A Customer Support Executive?

TOP RECRUITMENT COMPANIES IN INDIA