Server : Apache System : Linux server.xvl.jdw.mybluehostin.me 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : gcmknlac ( 1031) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/gcmknlac/public_html/admin/ |
<?php
if(isset($_POST["submit"]))
{
$url='localhost';
$username='root';
$password='';
$conn=mysqli_connect($url,$username,$password,"skr");
if(!$conn){
die('Could not Connect My Sql:' .mysqli_error());
}
$file = $_FILES['file']['tmp_name'];
$handle = fopen($file, "r");
$c = 0;
while(($filesop = fgetcsv($handle, 10000, ",")) !== false)
{
$fname = $filesop[0];
$lname = $filesop[1];
$sql = "insert into excel(fname,lname) values ('$fname','$lname')";
$stmt = mysqli_prepare($conn,$sql);
mysqli_stmt_execute($stmt);
$c = $c + 1;
}
if($sql){
echo "sucess";
} else {
echo "Sorry! Unable to impo.";
}
}
?>
<!DOCTYPE html>
<html>
<body>
<form enctype="multipart/form-data" method="post" role="form">
<div class="form-group">
<label for="exampleInputFile">File Upload</label>
<input type="file" name="file" id="file" size="150">
<p class="help-block">Only Excel/CSV File Import.</p>
</div>
<button type="submit" class="btn btn-default" name="submit" value="submit">Upload</button>
</form>
</body>
</html>