16- filing lecture 2 php

5
File Handling

Upload: raja-kumar

Post on 15-Jan-2015

216 views

Category:

Education


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 16- Filing lecture 2 php

File Handling

Page 2: 16- Filing lecture 2 php

File Pointer Functions

fseek() — Seeks on a file pointer

ftell() — Returns the current position of the file

read/write pointer.

rewind() — Rewind the position of a file pointer.

Page 3: 16- Filing lecture 2 php

Working With Directories

getcwd — Gets the current working directory. rmdir — Removes directory. mkdir — Makes directory. chdir — Change directory. rename — Renames a file or directory. unlink — Deletes a file. readdir — Read entry from directory handle. opendir — Open directory handle. pathinfo — Returns information about a file path.

Page 4: 16- Filing lecture 2 php

Reading A Directory

<?php $directory=".";

$res=opendir($directory); while($file=readdir($res)){

echo $directory."/".$file

} ?>

Page 5: 16- Filing lecture 2 php

Questions?