H I O X INDIA
FREE PHP Topics
 HOME  ||  Scripts  ||  Purchase  ||  Tutorials  ||  Images  ||  Tools  ||  Directories 
  :-)  Send Page   :-)   Feedback   :-)   Register   :-)   Links   :-)   Support   :-)   Bookmarks :-)  
 Forums   Hosting   Internet Stats   Easy Calculation   FUN Games 

PHP Topics
Introduction
Common Header
Random Number
Type
Form Variables
Date and Time
File Handling
Error Handling
DB Size
PHP Mail
String Tokens
Running PHP from JS
Array To JS
Array to PHP
Encryption
Ask Your Doubts
Feedback





Creating a file using php


Topic

How to create a file in php?



Explanation

Step 1:
Creating a new file in php is done using the function fopen().

Example: fopen('filename','w');

To create a file using php
a) call the function fopen with two required arguments.
b) the first argument should be the file name. The new file will be created with the file name under the current(same) directory.
c) the second argument should be 'w' indicating it as write mode.


Creating a new file under different Directory:
To create a file in a different directory we have to pass the full file path as the argument for file name.

Example: fopen('./images/filename.txt','w');

This will create a file named filename.txt under the directory "images/"
It is important to note that the directory specified in the path should exist.



others


privacypolicy     licence     sitemap
(c) copyright, 2004 hioxindia.com