File Handling in PHP
PHP has many built-in (ready made) functions for handling files.
we can open files from URL (Web) also.
Q1)Accept a file name from user and display the content.
<?php
if (isset($_POST['f1']))
{
$file=$_POST['f1'];
if ( ! (file_exists( $file ) ) )
{
echo "$file does not exist<br/>";
}
$data = file_get_contents( $file);
echo $data;
}
?>
<html>
<body><form method=post>
<input type=file name="f1"><input type=submit value=read>
</form>
</body>
</html>
fdff
ReplyDelete