This is very basic example of uploading any file to database using php and mysql.In this example the file name will be uploaded to the database table and the file will be stored in server.Use your connection,so i removed my connection details from the example.so lets start,

First,Creat a very basic design,In my example i just took a file field to upload a file.Save this file as upload1.php

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Surajit's Tutorial</title>
</head>

<body>
<form action="upload2.php" method="post" enctype='multipart/form-data'>
File:<input type='file' name='file1' id="fileField" />
<input type="submit" name="button" id="button" value="Submit" />
</form>
</body>
</html>

Now create the "upload2.php" file

<?php
$name
=$_FILES['file1']['name'] ;//access the file name
$dir='http://localhost/upload';//create a folder to save the file in the server
move_uploaded_file($_FILES['file1']['tmp_name'], "upload/" $_FILES["file1"]["name"]);
//connection string goes here,dont forget
$sql=mysql_query("insert into table_name values('$name')");
?>

 

01

PracticalApproach

>>
02

Learn toDevelop

03

GreateSupport

>>