Checking the Mode of a File : File Property « File Directory « PHP

Home
PHP
1.Chart
2.Class
3.Components
4.Cookie Session
5.Data Structure
6.Data Type
7.Date
8.Design Patterns
9.Development
10.DNS
11.Email
12.File Directory
13.Form
14.Functions
15.Graphics Image
16.HTML
17.Language Basics
18.Login Authentication
19.Math
20.MySQL Database
21.Network
22.Operator
23.PDF
24.Reflection
25.Statement
26.String
27.Utility Function
28.Web Services SOAP WSDL
29.XML
PHP » File Directory » File Property 
Checking the Mode of a File


<?php
  $myfile = "./test.txt";

  if (is_readable ($myfile)) {
    echo "The file can be read!""\n";
  else {
    echo "The file cannot be read.""/n";
  }
  
  if (is_writable ($myfile)) {
    echo "The file can be used for writing!""/n";
  else {
    echo "The file cannot be used for writing.""/n";
  }

  if (is_executable ($myfile)) {
    echo "The file is executable!""\n";
  else {
    echo "The file is not executable.""\n";
  }
?>
           
       
Related examples in the same category
1.Is it a file: is_file()
2.Is the file a directory: is_dir()
3.Is the file readable: is_readable()
4.Is the file writable: is_writable()
5.File changed time
6.File modified time
7.File accessed time
8.Determining the Size of a File
9.Get the file size: filesize
10.Is the file executable: is_executable
11.filegroup: Gets file group
12.File last changed time
13.File last accessed time
14.Get the file owner
15.Get file permission
16.File last updated time
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.