
Do you want online size converter.? Here i have that size converter for you you just see it.
So this converter can convert bytes into kb, mb, gb.
You can convert bytes into kb, mb, gb. So below is the code provided you just try iy out.
So here is the php functions and files that you will need for this project you can copy the code or simple download archive from the download link below which contains all the files used in this project.
<?php
function convert($size,$unit)
{
if($unit == "KB")
{
return $fileSize = round($size / 1024,4) . 'KB';
}
if($unit == "MB")
{
return $fileSize = round($size / 1024 / 1024,4) . 'MB';
}
if($unit == "GB")
{
return $fileSize = round($size / 1024 / 1024 / 1024,4) . 'GB';
}
}
if(isset($_POST['convert_size']))
{
$size=$_POST['size'];
$unit=$_POST['convert_unit'];
$size=convert($size,$unit);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/shoelace-css/1.0.0-beta9/shoelace.css"/>
</head>
<body>
<center>
<div id="convert_div">
<form method="post"action="" style="width:60%;margin-top:20%;">
<h2>Convert Bytes Into KB, MB, GB Using PHP</h2>
<input type="text" name="size" placeholder="Enter Bytes">
<select name="convert_unit">
<option>KB</option>
<option>MB</option>
<option>GB</option>
</select>
<br>
<input type="submit" class="button" name="convert_size" value="Convert Bytes">
<a class="button" href="https://softwebtuts.blogspot.com">For More Tutorials Visit SoftwebTuts</a>
</form>
<p><?php echo $size;?></p>
</div>
</center>
</body>
</html>
Completion :
So here we are, We have done and our project Convert Bytes Into Kb Mb Gb Using Php is ready now you can save all the files as provided.
And run this file in your localhost server and you are done.
Download Project (Convert Bytes Into Kb Mb Gb Using Php) File :
Our today's post ends here and I think you might like my this post and if you did make sure to subscribe to the newsletters of this website for more this kind of posts.
Post a comment
Was this article useful? Please Leave Your Feedback by writing what's in your mind, below.