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)
41 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)
41 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
Hourglass Workout Program by Luisagiuliet 2
PDF
76% (21)
Hourglass Workout Program by Luisagiuliet 2
51 pages
12 Week Program: Summer Body Starts Now
PDF
87% (46)
12 Week Program: Summer Body Starts Now
70 pages
Read People Like A Book by Patrick King-Edited
PDF
58% (81)
Read People Like A Book by Patrick King-Edited
12 pages
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
PDF
77% (13)
Livingood, Blake - Livingood Daily Your 21-Day Guide To Experience Real Health
260 pages
Cheat Code To The Universe
PDF
94% (79)
Cheat Code To The Universe
34 pages
Facial Gains Guide (001 081)
PDF
91% (45)
Facial Gains Guide (001 081)
81 pages
Curse of Strahd
PDF
95% (467)
Curse of Strahd
258 pages
The Psychiatric Interview - Daniel Carlat
PDF
91% (34)
The Psychiatric Interview - Daniel Carlat
473 pages
The Borax Conspiracy
PDF
91% (57)
The Borax Conspiracy
14 pages
The Secret Language of Attraction
PDF
86% (107)
The Secret Language of Attraction
278 pages
How To Develop and Write A Grant Proposal
PDF
83% (542)
How To Develop and Write A Grant Proposal
17 pages
Penis Enlargement Secret
PDF
60% (124)
Penis Enlargement Secret
12 pages
Workbook For The Body Keeps The Score
PDF
89% (53)
Workbook For The Body Keeps The Score
111 pages
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
PDF
83% (1016)
Donald Trump & Jeffrey Epstein Rape Lawsuit and Affidavits
13 pages
KamaSutra Positions
PDF
78% (69)
KamaSutra Positions
55 pages
7 Hermetic Principles
PDF
93% (30)
7 Hermetic Principles
3 pages
27 Feedback Mechanisms Pogil Key
PDF
77% (13)
27 Feedback Mechanisms Pogil Key
6 pages
Frank Hammond - List of Demons
PDF
92% (92)
Frank Hammond - List of Demons
3 pages
Phone Codes
PDF
79% (28)
Phone Codes
5 pages
36 Questions That Lead To Love
PDF
91% (35)
36 Questions That Lead To Love
3 pages
How 2 Setup Trust
PDF
97% (307)
How 2 Setup Trust
3 pages
The 36 Questions That Lead To Love - The New York Times
PDF
94% (34)
The 36 Questions That Lead To Love - The New York Times
3 pages
100 Questions To Ask Your Partner
PDF
78% (36)
100 Questions To Ask Your Partner
2 pages
Satanic Calendar
PDF
25% (56)
Satanic Calendar
4 pages
The 36 Questions That Lead To Love - The New York Times
PDF
95% (21)
The 36 Questions That Lead To Love - The New York Times
3 pages
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
PDF
100% (8)
14 Easiest & Hardest Muscles To Build (Ranked With Solutions)
27 pages
Jeffrey Epstein39s Little Black Book Unredacted PDF
PDF
75% (12)
Jeffrey Epstein39s Little Black Book Unredacted PDF
95 pages
1001 Songs
PDF
69% (72)
1001 Songs
1,798 pages
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
PDF
23% (954)
The 4 Hour Workweek, Expanded and Updated by Timothy Ferriss - Excerpt
38 pages
Zodiac Sign & Their Most Common Addictions
PDF
63% (30)
Zodiac Sign & Their Most Common Addictions
9 pages
File Handling
PDF
No ratings yet
File Handling
25 pages
P5 2 PDF
PDF
No ratings yet
P5 2 PDF
22 pages
File and Directory Handling
PDF
No ratings yet
File and Directory Handling
8 pages
PHP File Handling
PDF
No ratings yet
PHP File Handling
8 pages
File Upload File and Directories
PDF
No ratings yet
File Upload File and Directories
11 pages
Chapter 5 & 6
PDF
No ratings yet
Chapter 5 & 6
43 pages
File Handling in PHP
PDF
No ratings yet
File Handling in PHP
9 pages
14.module4 - PHP FILE EMAIL NEW - 12 PDF
PDF
No ratings yet
14.module4 - PHP FILE EMAIL NEW - 12 PDF
32 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
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
Date : The PHP Date Function
PDF
No ratings yet
Date : The PHP Date Function
2 pages
Creating The Upload Form (Codeidniter)
PDF
No ratings yet
Creating The Upload Form (Codeidniter)
3 pages
Basic Linux Commands PDF
PDF
No ratings yet
Basic Linux Commands PDF
8 pages
EXP-1
PDF
No ratings yet
EXP-1
4 pages
PHP Database
PDF
No ratings yet
PHP Database
22 pages
Linux Manage User Group
PDF
No ratings yet
Linux Manage User Group
25 pages
Database, Mysql, SQL
PDF
No ratings yet
Database, Mysql, SQL
37 pages
2.3 Managing User and Group
PDF
No ratings yet
2.3 Managing User and Group
12 pages
Chapter 3 - User Management
PDF
No ratings yet
Chapter 3 - User Management
19 pages
DATABASEPROG
PDF
No ratings yet
DATABASEPROG
15 pages
ArrayPresentation in C
PDF
No ratings yet
ArrayPresentation in C
19 pages
CH 5
PDF
No ratings yet
CH 5
83 pages
Sending E-Mails: The PHP Mail Function
PDF
No ratings yet
Sending E-Mails: The PHP Mail Function
3 pages
Java Anatomy
PDF
No ratings yet
Java Anatomy
16 pages
4667010
PDF
No ratings yet
4667010
22 pages
DD 2 1
PDF
No ratings yet
DD 2 1
13 pages
01 Introduction To Java
PDF
No ratings yet
01 Introduction To Java
38 pages
Sending Email With PHP
PDF
No ratings yet
Sending Email With PHP
2 pages
Function in PHP
PDF
No ratings yet
Function in PHP
11 pages
Create The Upload File Form
PDF
No ratings yet
Create The Upload File Form
2 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
Introduction To Python
PDF
No ratings yet
Introduction To Python
0 pages
PHP (Lec) Sa1
PDF
No ratings yet
PHP (Lec) Sa1
132 pages
Advanced: Dynamic Webpage Development
PDF
No ratings yet
Advanced: Dynamic Webpage Development
15 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
EMAILING With PHP
PDF
100% (1)
EMAILING With PHP
5 pages
PHP Cookies
PDF
No ratings yet
PHP Cookies
4 pages
SMJP 1043: Programming (C++) For Engineers
PDF
100% (1)
SMJP 1043: Programming (C++) For Engineers
51 pages
PHP 5 Sessions: What Is A PHP Session?
PDF
No ratings yet
PHP 5 Sessions: What Is A PHP Session?
4 pages
Sending Emails With PHP
PDF
No ratings yet
Sending Emails With PHP
5 pages
PHP - Date & Time
PDF
No ratings yet
PHP - Date & Time
5 pages
Laboratory Exercises
PDF
100% (1)
Laboratory Exercises
121 pages
SQL CRUD: Create, Read, Update and Delete
PDF
0% (1)
SQL CRUD: Create, Read, Update and Delete
2 pages
PHP Book
PDF
No ratings yet
PHP Book
66 pages
Php-Web Designing
PDF
No ratings yet
Php-Web Designing
63 pages
Python Practicals
PDF
No ratings yet
Python Practicals
20 pages
Built-In Objects in Javascript
PDF
No ratings yet
Built-In Objects in Javascript
39 pages
PHP - File Uploading: Creating An Upload Form
PDF
No ratings yet
PHP - File Uploading: Creating An Upload Form
4 pages
6. Arrays
PDF
No ratings yet
6. Arrays
45 pages
Php/Mysql Tutorial: Introduction To Database
PDF
No ratings yet
Php/Mysql Tutorial: Introduction To Database
58 pages
Lecture 4-Managing Users1-1
PDF
No ratings yet
Lecture 4-Managing Users1-1
28 pages
Introducing: Mongodb: David J. C. Beach
PDF
No ratings yet
Introducing: Mongodb: David J. C. Beach
57 pages
PHP Json Encoding Manual
PDF
No ratings yet
PHP Json Encoding Manual
31 pages
PHP Paper PDF
PDF
100% (1)
PHP Paper PDF
3 pages
Advanced PHP Manual
PDF
No ratings yet
Advanced PHP Manual
246 pages
CSO Lecture Notes Unit-1
PDF
No ratings yet
CSO Lecture Notes Unit-1
33 pages
Advanced PHP PDF
PDF
No ratings yet
Advanced PHP PDF
7 pages
Php File Handling
PDF
No ratings yet
Php File Handling
8 pages