Address
:
[go:
up one dir
,
main page
]
Include Form
Remove Scripts
Session Cookies
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)
59 views
7 pages
PHP File Handling
Uploaded by
tamannajangid3223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
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)
59 views
7 pages
PHP File Handling
Uploaded by
tamannajangid3223
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Carousel Previous
Carousel Next
Download
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
Chapter 5 & 6
PDF
No ratings yet
Chapter 5 & 6
43 pages
PHP File Handling
PDF
No ratings yet
PHP File Handling
8 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
File Handling in PHP
PDF
No ratings yet
File Handling in PHP
9 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
DATABASEPROG
PDF
No ratings yet
DATABASEPROG
15 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
Date : The PHP Date Function
PDF
No ratings yet
Date : The PHP Date Function
2 pages
2.3 Managing User and Group
PDF
No ratings yet
2.3 Managing User and Group
12 pages
EXP-1
PDF
No ratings yet
EXP-1
4 pages
Database, Mysql, SQL
PDF
No ratings yet
Database, Mysql, SQL
37 pages
Chapter 3 - User Management
PDF
No ratings yet
Chapter 3 - User Management
19 pages
ArrayPresentation in C
PDF
No ratings yet
ArrayPresentation in C
19 pages
4667010
PDF
No ratings yet
4667010
22 pages
Linux Manage User Group
PDF
No ratings yet
Linux Manage User Group
25 pages
Linux Operating System Unit 1
PDF
No ratings yet
Linux Operating System Unit 1
23 pages
Java Anatomy
PDF
No ratings yet
Java Anatomy
16 pages
DD 2 1
PDF
No ratings yet
DD 2 1
13 pages
CH 5
PDF
No ratings yet
CH 5
83 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
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
Basic Linux Commands PDF
PDF
No ratings yet
Basic Linux Commands PDF
8 pages
File Handling in PHP
PDF
No ratings yet
File Handling in PHP
12 pages
HEYYYYYasdadasdasdasds
PDF
No ratings yet
HEYYYYYasdadasdasdasds
5 pages
Create The Upload File Form
PDF
No ratings yet
Create The Upload File Form
2 pages
Sending E-Mails: The PHP Mail Function
PDF
No ratings yet
Sending E-Mails: The PHP Mail Function
3 pages
Advanced: Dynamic Webpage Development
PDF
No ratings yet
Advanced: Dynamic Webpage Development
15 pages
Function in PHP
PDF
No ratings yet
Function in PHP
11 pages
PHP Cookies
PDF
No ratings yet
PHP Cookies
4 pages
PHP - Date & Time
PDF
No ratings yet
PHP - Date & Time
5 pages
PHP Beginner 2018 02
PDF
No ratings yet
PHP Beginner 2018 02
28 pages
CSCP 363: Object Oriented Programming in Java I
PDF
No ratings yet
CSCP 363: Object Oriented Programming in Java I
21 pages
EMAILING With PHP
PDF
100% (1)
EMAILING With PHP
5 pages
Built-In Objects in Javascript
PDF
No ratings yet
Built-In Objects in Javascript
39 pages
PHP Book
PDF
No ratings yet
PHP Book
66 pages
Sending Emails With PHP
PDF
No ratings yet
Sending Emails With PHP
5 pages
SQL CRUD: Create, Read, Update and Delete
PDF
0% (1)
SQL CRUD: Create, Read, Update and Delete
2 pages
Lecture 2 Basic CPU Architectures
PDF
No ratings yet
Lecture 2 Basic CPU Architectures
7 pages
PHP Json Encoding Manual
PDF
No ratings yet
PHP Json Encoding Manual
31 pages
PHP Tutorial - W3schools2 PDF
PDF
No ratings yet
PHP Tutorial - W3schools2 PDF
88 pages
PHP:Hypertext Preprocessor
PDF
No ratings yet
PHP:Hypertext Preprocessor
30 pages
PHP (Lec) Sa1
PDF
No ratings yet
PHP (Lec) Sa1
132 pages
Python Practicals
PDF
No ratings yet
Python Practicals
20 pages
Php/Mysql Tutorial: Introduction To Database
PDF
No ratings yet
Php/Mysql Tutorial: Introduction To Database
58 pages
Lecture5 PHP Mysql
PDF
No ratings yet
Lecture5 PHP Mysql
66 pages
(M5-M6) PHP
PDF
No ratings yet
(M5-M6) PHP
69 pages
PHP Session: Prepared By: Prof. Disha H. Parekh
PDF
No ratings yet
PHP Session: Prepared By: Prof. Disha H. Parekh
11 pages
Laboratory Exercises
PDF
100% (1)
Laboratory Exercises
121 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
CS201 11
PDF
No ratings yet
CS201 11
30 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