Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
31 views
PHP File Handling
Uploaded by
tamannajangid3223
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download now
Download
Save PHP File Handling For Later
Download
Save
Save PHP File Handling For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
31 views
PHP File Handling
Uploaded by
tamannajangid3223
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download now
Download
Save PHP File Handling For Later
Carousel Previous
Carousel Next
Save
Save PHP File Handling For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 7
Search
Fullscreen
PHP File Handling
PHP File Handling
PHP File System allows us to -
create file,
file character by character,
Writ file line by line,
read file,
append file,
delete file
close file.
PHP Open File -fopen()
The PHP fopen() function is used to open a file.
Syntax
resource fopen ( string $filename , string $mode [, bool $use_
include_path = false [, resource $context ]] )
Example
<?php
$handle = fopen("c:\\folder\\file.txt", "r");
?>
PHP Close File - fclose()
The PHP fclose() function is used to close an open file
pointer.
Syntax
fclose ( resource $handle )
Example
<?php
fclose($handle);
?>
PHP Read File - fread()
The PHP fread() function is used to read the content of the file. It accepts two
arguments: resource and file size.
Syntax
string fread ( resource $handle , int $length )
Example
<?php
$filename = "c:\\myfile.txt";
$handle = fopen($filename, "r");//open file in read mode
$contents = fread($handle, filesize($filename));//read file
echo $contents;//printing data of file
fclose($handle);//close file
?>
Output
hello php file
PHP Write File - fwrite()
The PHP fwrite() function is used to write content of the string into file.
Syntax
int fwrite ( resource $handle , string $string [, int $length ] )
Example
<?php
$fp = fopen('data.txt', 'w');//open file in write mode
fwrite($fp, 'hello ');
fwrite($fp, 'php file');
fclose($fp);
echo "File written successfully";
?>
Output
File written successfully
PHP Delete File - unlink()
The PHP unlink() function is used to delete file.
Syntax
bool unlink ( string $filename [, resource $context ] )
Example
<?php
unlink('data.txt');
echo "File deleted successfully";
?>
You might also like
File Handling
PDF
No ratings yet
File Handling
25 pages
P5 2 PDF
PDF
No ratings yet
P5 2 PDF
22 pages
14.module4 - PHP FILE EMAIL NEW - 12 PDF
PDF
No ratings yet
14.module4 - PHP FILE EMAIL NEW - 12 PDF
32 pages
File Handling in PHP
PDF
No ratings yet
File Handling in PHP
9 pages
Chapter 5 & 6
PDF
No ratings yet
Chapter 5 & 6
43 pages
File and Directory Handling
PDF
No ratings yet
File and Directory Handling
8 pages
File Upload File and Directories
PDF
No ratings yet
File Upload File and Directories
11 pages
PHP File Handling: Reading From Files With PHP Function
PDF
No ratings yet
PHP File Handling: Reading From Files With PHP Function
13 pages
PHP File Handling
PDF
No ratings yet
PHP File Handling
8 pages
Practical PHP: Server-Side Programing Abedalrhman Alkhateeb
PDF
No ratings yet
Practical PHP: Server-Side Programing Abedalrhman Alkhateeb
31 pages
PHP - File Uploading
PDF
No ratings yet
PHP - File Uploading
4 pages
PHP Database
PDF
No ratings yet
PHP Database
22 pages
Creating The Upload Form (Codeidniter)
PDF
No ratings yet
Creating The Upload Form (Codeidniter)
3 pages
EXP-1
PDF
No ratings yet
EXP-1
4 pages
Basic Linux Commands PDF
PDF
No ratings yet
Basic Linux Commands PDF
8 pages
DATABASEPROG
PDF
No ratings yet
DATABASEPROG
15 pages
Chapter 3 - User Management
PDF
No ratings yet
Chapter 3 - User Management
19 pages
Linux Manage User Group
PDF
No ratings yet
Linux Manage User Group
25 pages
2.3 Managing User and Group
PDF
No ratings yet
2.3 Managing User and Group
12 pages
ArrayPresentation in C
PDF
No ratings yet
ArrayPresentation in C
19 pages
Database, Mysql, SQL
PDF
No ratings yet
Database, Mysql, SQL
37 pages
CH 5
PDF
No ratings yet
CH 5
83 pages
4667010
PDF
No ratings yet
4667010
22 pages
PHP File Handling: Dr. Jenila Livingston L.M. VIT Chennai
PDF
No ratings yet
PHP File Handling: Dr. Jenila Livingston L.M. VIT Chennai
24 pages
File Handling in PHP
PDF
No ratings yet
File Handling in PHP
12 pages
Java Anatomy
PDF
No ratings yet
Java Anatomy
16 pages
01 Introduction To Java
PDF
No ratings yet
01 Introduction To Java
38 pages
Function in PHP
PDF
No ratings yet
Function in PHP
11 pages
PHP Cookies
PDF
No ratings yet
PHP Cookies
4 pages
DD 2 1
PDF
No ratings yet
DD 2 1
13 pages
PHP (Lec) Sa1
PDF
No ratings yet
PHP (Lec) Sa1
132 pages
PHP 5 Sessions: What Is A PHP Session?
PDF
No ratings yet
PHP 5 Sessions: What Is A PHP Session?
4 pages
PHP - File Uploading: Creating An Upload Form
PDF
No ratings yet
PHP - File Uploading: Creating An Upload Form
4 pages
Advanced: Dynamic Webpage Development
PDF
No ratings yet
Advanced: Dynamic Webpage Development
15 pages
Sending E-Mails: The PHP Mail Function
PDF
No ratings yet
Sending E-Mails: The PHP Mail Function
3 pages
Delete Data From Mysql Database Using PHP: Table - Name Column - Name Some - Value
PDF
No ratings yet
Delete Data From Mysql Database Using PHP: Table - Name Column - Name Some - Value
8 pages
Sending Email With PHP
PDF
No ratings yet
Sending Email With PHP
2 pages
Create The Upload File Form
PDF
No ratings yet
Create The Upload File Form
2 pages
SQL CRUD: Create, Read, Update and Delete
PDF
0% (1)
SQL CRUD: Create, Read, Update and Delete
2 pages
Date : The PHP Date Function
PDF
No ratings yet
Date : The PHP Date Function
2 pages
PHP Session: Prepared By: Prof. Disha H. Parekh
PDF
No ratings yet
PHP Session: Prepared By: Prof. Disha H. Parekh
11 pages
EMAILING With PHP
PDF
100% (1)
EMAILING With PHP
5 pages
HEYYYYYasdadasdasdasds
PDF
No ratings yet
HEYYYYYasdadasdasdasds
5 pages
Lecture5 PHP Mysql
PDF
No ratings yet
Lecture5 PHP Mysql
66 pages
PHP Paper PDF
PDF
100% (1)
PHP Paper PDF
3 pages
Lab-1 Introduction To Java - 1148858255
PDF
No ratings yet
Lab-1 Introduction To Java - 1148858255
27 pages
Advance Computer Architecture (Autosaved)
PDF
No ratings yet
Advance Computer Architecture (Autosaved)
128 pages
PHP Beginner 2018 02
PDF
No ratings yet
PHP Beginner 2018 02
28 pages
What Is Information Security
PDF
No ratings yet
What Is Information Security
19 pages
Advanced PHP Manual
PDF
No ratings yet
Advanced PHP Manual
246 pages
(M5-M7) PHP
PDF
No ratings yet
(M5-M7) PHP
96 pages
Lecture 7 - PHP and MySQL
PDF
No ratings yet
Lecture 7 - PHP and MySQL
17 pages
Php-Web Designing
PDF
No ratings yet
Php-Web Designing
63 pages
PHP - Date & Time
PDF
No ratings yet
PHP - Date & Time
5 pages
Nota PHP PDF
PDF
No ratings yet
Nota PHP PDF
50 pages
PHP & MySQL Question Bank
PDF
No ratings yet
PHP & MySQL Question Bank
16 pages
Chapter 3 Getting Started With PHP
PDF
No ratings yet
Chapter 3 Getting Started With PHP
13 pages
6 PHP Global Variables
PDF
No ratings yet
6 PHP Global Variables
5 pages
Php File Handling
PDF
No ratings yet
Php File Handling
8 pages
Unit 3 PHP
PDF
No ratings yet
Unit 3 PHP
12 pages
Related titles
Click to expand Related Titles
Carousel Previous
Carousel Next
File Handling
PDF
File Handling
P5 2 PDF
PDF
P5 2 PDF
14.module4 - PHP FILE EMAIL NEW - 12 PDF
PDF
14.module4 - PHP FILE EMAIL NEW - 12 PDF
File Handling in PHP
PDF
File Handling in PHP
Chapter 5 & 6
PDF
Chapter 5 & 6
File and Directory Handling
PDF
File and Directory Handling
File Upload File and Directories
PDF
File Upload File and Directories
PHP File Handling: Reading From Files With PHP Function
PDF
PHP File Handling: Reading From Files With PHP Function
PHP File Handling
PDF
PHP File Handling
Practical PHP: Server-Side Programing Abedalrhman Alkhateeb
PDF
Practical PHP: Server-Side Programing Abedalrhman Alkhateeb
PHP - File Uploading
PDF
PHP - File Uploading
PHP Database
PDF
PHP Database
Creating The Upload Form (Codeidniter)
PDF
Creating The Upload Form (Codeidniter)
EXP-1
PDF
EXP-1
Basic Linux Commands PDF
PDF
Basic Linux Commands PDF
DATABASEPROG
PDF
DATABASEPROG
Chapter 3 - User Management
PDF
Chapter 3 - User Management
Linux Manage User Group
PDF
Linux Manage User Group
2.3 Managing User and Group
PDF
2.3 Managing User and Group
ArrayPresentation in C
PDF
ArrayPresentation in C
Database, Mysql, SQL
PDF
Database, Mysql, SQL
CH 5
PDF
CH 5
4667010
PDF
4667010
PHP File Handling: Dr. Jenila Livingston L.M. VIT Chennai
PDF
PHP File Handling: Dr. Jenila Livingston L.M. VIT Chennai
File Handling in PHP
PDF
File Handling in PHP
Java Anatomy
PDF
Java Anatomy
01 Introduction To Java
PDF
01 Introduction To Java
Function in PHP
PDF
Function in PHP
PHP Cookies
PDF
PHP Cookies
DD 2 1
PDF
DD 2 1
PHP (Lec) Sa1
PDF
PHP (Lec) Sa1
PHP 5 Sessions: What Is A PHP Session?
PDF
PHP 5 Sessions: What Is A PHP Session?
PHP - File Uploading: Creating An Upload Form
PDF
PHP - File Uploading: Creating An Upload Form
Advanced: Dynamic Webpage Development
PDF
Advanced: Dynamic Webpage Development
Sending E-Mails: The PHP Mail Function
PDF
Sending E-Mails: The PHP Mail Function
Delete Data From Mysql Database Using PHP: Table - Name Column - Name Some - Value
PDF
Delete Data From Mysql Database Using PHP: Table - Name Column - Name Some - Value
Sending Email With PHP
PDF
Sending Email With PHP
Create The Upload File Form
PDF
Create The Upload File Form
SQL CRUD: Create, Read, Update and Delete
PDF
SQL CRUD: Create, Read, Update and Delete
Date : The PHP Date Function
PDF
Date : The PHP Date Function
PHP Session: Prepared By: Prof. Disha H. Parekh
PDF
PHP Session: Prepared By: Prof. Disha H. Parekh
EMAILING With PHP
PDF
EMAILING With PHP
HEYYYYYasdadasdasdasds
PDF
HEYYYYYasdadasdasdasds
Lecture5 PHP Mysql
PDF
Lecture5 PHP Mysql
PHP Paper PDF
PDF
PHP Paper PDF
Lab-1 Introduction To Java - 1148858255
PDF
Lab-1 Introduction To Java - 1148858255
Advance Computer Architecture (Autosaved)
PDF
Advance Computer Architecture (Autosaved)
PHP Beginner 2018 02
PDF
PHP Beginner 2018 02
What Is Information Security
PDF
What Is Information Security
Advanced PHP Manual
PDF
Advanced PHP Manual
(M5-M7) PHP
PDF
(M5-M7) PHP
Lecture 7 - PHP and MySQL
PDF
Lecture 7 - PHP and MySQL
Php-Web Designing
PDF
Php-Web Designing
PHP - Date & Time
PDF
PHP - Date & Time
Nota PHP PDF
PDF
Nota PHP PDF
PHP & MySQL Question Bank
PDF
PHP & MySQL Question Bank
Chapter 3 Getting Started With PHP
PDF
Chapter 3 Getting Started With PHP
6 PHP Global Variables
PDF
6 PHP Global Variables
Php File Handling
PDF
Php File Handling
Unit 3 PHP
PDF
Unit 3 PHP