Get File Size and File Type In PHP
With this PHP script you can find size and type (extension) of required file.
Get File Size and Type
Create a form with single file field named as file.
<form action="getInfo.php" method="post" enctype="multipart/form-data"> <input type="file" name="file"> <input type="submit" name="Submit" value="Submit"> </form>
Browse and put a file in it and post to other PHP page getInfo.php containing following script.
<?php $file=$_REQUEST["file"]; $image=$_FILES['file']['name']; // file name echo "Image name > $image"; echo "<br><br>"; // file size echo "Image Size > $file_size"; echo "<br><br>"; // file size in KB $size="$file_size"; $ms=$size/1024; echo "Image Size > $ms KB"; echo "<br><br> or "; echo $file . ': ' . filesize($file) . ' bytes'; // file type echo "File Type > $file_type"; ?>
Using this you should be able to get file info.
Download File Size and Type Example
:: Example works with Globals on (not recommended, Do Globals on for learning purpose only)
