Php

File uploading concept in PHP
File uploading concept in PHP

Topic-50 File uploading concept in PHP Part – 1 DOC,PDF -We are going to discuss about uploading files to the server. -In php we can easily upload files into a server. -We have a global variable $_FILES in PHP. It is an associate double dimension array & this variable is used to store the information of file. -We can get…

File Renaming in PHP
File Renaming in PHP

Topic-49 File Renaming in PHP DOC,PDF -In this topic we are going to rename a file. -we have rename () function in php which is used to rename the files. -So rename() function will rename oldname to newname, if the new name exists then it will be overwritten. Syntax: rename( old_name, new_name ); This function returns TRUE on success, or…

Deleting a File in PHP
Deleting a File in PHP

Topic – 48 Deleting a File in PHP DOC,PDF -In this topic we are going to delete a file i.e., existing files. -So if we want to delete a file then we can delete the file. -we have unlink() function to delete a file. Syntax: unlink(filename); -This function will return true on deleting a file -Returns false if the file…

File_exists( ) function in PHP
File_exists( ) function in PHP

Topic -47 File_exists( ) function in PHP DOC,PDF Checking if a File Exists: -In this topic we are going to discuss about checking the file whether exists or not. -Here we have a file function to check whether the file exists or not. -file_exist() function is used to check the file.It returns true if the file exists else returns false.…

File Listing in PHP
File Listing in PHP

Topic – 46 File Listing in PHP DOC,PDF -In this topic we are going to discuss about how to display the list of files which are present in a folder (directory). -In previous topic we learned how to open a file and read the file. -Now if we have number of files then how to retrieve them. So we have…

File Handling in PHP
File Handling in PHP

Topic – 45 File Handling in PHP Part – 5 DOC,PDF -We have seen how to break a string into an array in last part. -Now in this part we are going to see how to covert an array into a string with the required connector. Let us consider the following, we have an array of names as follows, $name_array…

File Handling in PHP
File Handling in PHP

Topic – 45 File Handling in PHP Part – 4 DOC,PDF Explode function: -The explode function is used to convert a string in a file to an array. -The explode function will split the string into substrings. Syntax: explode (‘delimiter’, string); delimiter        –           is to specify break point of the string. string              –           is the string to…

File Handling in PHP
File Handling in PHP

Topic – 45 File Handling in PHP Part-3 DOC,PDF Appending data to the end of the file: -To append the data we need to open the file in appending mode. fopen(‘filename’,’a’); -Let us consider the following program, Program: <?php $file = fopen(fileA.txt,’a’); fwrite($file,’Alex’.’\n’); fclose(fileA.txt); ?> Output: -When you run the above code then string ‘Alex’ is going to append to…

File Handling in PHP
File Handling in PHP

Topic – 45 File Handling in PHP Part – 2 DOC,PDF Reading the data from a file: -Here in this topic we are going to discuss about how to retrieve a file in browser. -We can retrieve a file simply by using echo statement. Program: <?php $file = fopen(‘file1.txt’,’r’); fwrite($file,”Hi Welcome”); echo fread($file,filesize(‘file1.txt’)); fclose($file); ?> Output: -Here in the above…

File Handling in PHP
File Handling in PHP

Topic-45 File Handling in PHP Part-1 DOC,PDF Here we are discussing about the file handling in php. -we can create, write and read the files in php. -file handling is important in php. -we can create and manage the files in php using some pre-defined functions. Creating or Opening file: -we have fopen() function to open or create the file.…