How to get file information in php

Page 1

How to Get File Information in PHP How to get file information in php - A file certainly has information about the file. Such file information such as file size, file type, file creation time and others. For that reason in this article I will submit a tutorial on how to get file information in php. Some functions related to file information and manipulation are listed in the table as follows: Function file_exists($file) is_file($file)

Information Check if $file exists or not Check if $file is a file or not. is_dir($file) Check if $ file is a directory or not. is_executable($file) Check if $ file includes files that can be run directly or not. is_writable($file) Check if $ file includes files that can be written or edited. is_readable($file) Check if $ file includes a readable file or not. fileatime($file) Generates the last access time of the file (unix timestamp). filectime($file) Generates file creation time (unix timestamp). filemtime($file) Generates the last modification time of the file (in unix timestamp). filesize($file) Generate large file size (in bytes). filetype($file) Generate file types. To be able to understand more, here I give examples of programs to Get File Information using php. Program 1 File Name: file11.php Description: The program checks for the existence of a file. Type the following php code into notepad. <?php $filename = "data.txt"; if (file_exists($filename)) { echo "File $filename THERE IS"; } else {


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
How to get file information in php by Info Kita - Issuu