File Handling in Php-
Hello Friends Ajj Me Apko Btaunga Ki Kis Parkar Ham Php Me File Handling Operation Karte Hai.Yanha Me Apko Ek Example Ke Dwara Btaunga.Yanha Ham Ek Tool Bnayege Jiski Madad Se Ham .Txt,.Pdf,.Doc File Create Karege.aur Read Krege.
Steps-
Yanha Ham Simple Steps Follow Karege.Yanha Ham Sabse Pehle File Ka Name Enter Karege Jis Name Se Ham File Create Karna Chahte Hai,Uske Bad Ham Extension Select Karege Means Format Select Karege Jis Format Me Aap File Create Karna Chahte Hai Means Text File ,Pdf File Etc
Ab Content Me Apni File Ka Content Dalege And Last Me Submit Par Click Kar Dege.
Create A File Logic- Yanha Ham Ek Simple Logic Ka Use Karge Means Ham Yanha Sabse Pehle Isset Function Ka Use Karge …Agar Koi Sare Detail Like Filename,Content ,Select Extention Karke Submit Par Click Karta Hai To Yanha Sabse Pehle Ham File_Exit Function Ka Use Karege Jo Ye Check Karega Ki File Pehle Se Create To Nhi Hai Agar File Pehle Se Create Hue Hogi Means Hmare Folder Me Available Hogi To Ye Hame Message Dega Ki “File Already Exit” But Agar File Pehle Se Available Nhi Hue To Ham File Create Karne Ke Liye Niche Diye Gye Function Ka Use Karege Jo File Ko Create Karega Or File
$fo = fopen($file,"w");
fwrite($fo,$data);
Echo "File Created Succesfully";Create Hone Ke Bad Hame Message Show Karega Ki “File Successfully Created”;
Read A File Logic- Yanha Ham Firse Isset Function Ka Use Karege .Yanha Jese Koi Form Me File Name And Extension Select Karke Read File Par Click Karege ,Yanha Ham File_Exist Function Ka Use Karege Agar File Pehle Se Available Hue To Ye File Ko Read Karega Or Us File Ka Data(Content) Screen Par Show Karega
if(file_exists($file))
$fo = fopen($file,"r");
$contents = fread($fo,filesize($file));
But Agar File Available Nhi Hue To Ye Message Display Karega Ki “File Not Exits “
Full complete code-
File Handling Bhut He Useful Concept Hai Php Mai Me Apko Iska Ek Simple Use Btata Hu Aap File Handling Ka Use Karke Kisi Be Website Ka Phishing Page(Duplicate) Page Bnake Kisi Be User Ki Id Hack Kar Sakte Ho.File Handling Ka Use Hacking Me Be Kiya Jata Hai.
Means Hacker Same To Same Kisi Be Website Ka Phishing Page Create Karte Hai Or Victim Ko Send Karte Hai Victim Use Real Website Samajhkar Jab Wanha Apni Id And Password Dalkar Submit Par Click Karta Hai To Wanha File Handling Ke Write Function(Create A File Function) Ka Use Kiya Jata Jese He User Id And Password Dalkar Login Karta Hai To Ek File Create Ho Jati Hai Hacker Ke Server Par Means Webhosting Me Janha Us File Me Apki Id And Password Ki Sare Detail Hote Hai .Jiska Use Karke Hacker Apki Email Id Ko Hack Kar Sakta Hai.
File Handling Ke Or Be Bhut Se Use Hote Hai Me Apko Mere Ane Wali Post Me Iske Bare Me Detail Me Btaunga Agar Apko Post Se Related Koi Be Problem A Rhe Hai To Aap Mujse Comment Me Puch Sakte Hai Me Apki Puri Sahayta Karne Ki Koshish Karunga
Thank You
Team Gajabwap Web In Hindi
Also Read-
Contact Form Kaise Bnaye-By Using Phpmailer
Hello Friends Ajj Me Apko Btaunga Ki Kis Parkar Ham Php Me File Handling Operation Karte Hai.Yanha Me Apko Ek Example Ke Dwara Btaunga.Yanha Ham Ek Tool Bnayege Jiski Madad Se Ham .Txt,.Pdf,.Doc File Create Karege.aur Read Krege.
Steps-
Yanha Ham Simple Steps Follow Karege.Yanha Ham Sabse Pehle File Ka Name Enter Karege Jis Name Se Ham File Create Karna Chahte Hai,Uske Bad Ham Extension Select Karege Means Format Select Karege Jis Format Me Aap File Create Karna Chahte Hai Means Text File ,Pdf File Etc
Ab Content Me Apni File Ka Content Dalege And Last Me Submit Par Click Kar Dege.
Create A File Logic- Yanha Ham Ek Simple Logic Ka Use Karge Means Ham Yanha Sabse Pehle Isset Function Ka Use Karge …Agar Koi Sare Detail Like Filename,Content ,Select Extention Karke Submit Par Click Karta Hai To Yanha Sabse Pehle Ham File_Exit Function Ka Use Karege Jo Ye Check Karega Ki File Pehle Se Create To Nhi Hai Agar File Pehle Se Create Hue Hogi Means Hmare Folder Me Available Hogi To Ye Hame Message Dega Ki “File Already Exit” But Agar File Pehle Se Available Nhi Hue To Ham File Create Karne Ke Liye Niche Diye Gye Function Ka Use Karege Jo File Ko Create Karega Or File
$fo = fopen($file,"w");
fwrite($fo,$data);
Echo "File Created Succesfully";Create Hone Ke Bad Hame Message Show Karega Ki “File Successfully Created”;
Read A File Logic- Yanha Ham Firse Isset Function Ka Use Karege .Yanha Jese Koi Form Me File Name And Extension Select Karke Read File Par Click Karege ,Yanha Ham File_Exist Function Ka Use Karege Agar File Pehle Se Available Hue To Ye File Ko Read Karega Or Us File Ka Data(Content) Screen Par Show Karega
if(file_exists($file))
$fo = fopen($file,"r");
$contents = fread($fo,filesize($file));
But Agar File Available Nhi Hue To Ye Message Display Karega Ki “File Not Exits “
Full complete code-
<center>
<?php
if(isset($_POST['Submit']))
{
echo $filename=$_POST['file'];
echo "<br>";
$ext=$_POST['ext'];
echo "<br>";
echo $data=$_POST['data'];
echo "<br>";
$file=$filename.$ext;
if(file_exists($file))
{
echo "File already exists";
}
else
{
$fo = fopen($file,"w");
fwrite($fo,$data);
echo "File Created Succesfully";
}
}
if(isset($_POST['disp']))
{
$filename=$_POST['file'];
$ext=$_POST['ext'];
$file=$filename.$ext;
if(file_exists($file))
{
$fo = fopen($file,"r");
$contents = fread($fo,filesize($file));
}
else
{
echo "File does not exists";
}
}
?>
<body background="photo.jpg">
<form method="post">
<h1>File Handling in php</h1>
<h2>Create and Read Files</h2><h1>
Enter your file<input type="text" name="file"/><br/>
Choose your extension<select name="ext">
<option value="">choose ur exten</option>
<option>.txt</option>
<option>.docs</option>
<option>.pdf</option>
</select><br/>
Enter your contents<textarea rows="10" cols="30" name="data">
<?php echo @$contents ; ?>
</textarea><br/>
<input type="submit" value="Submit" name="Submit"/>
<input type="submit" value="Disp" name="disp"/>
</h1>
</form>
</center>
Demo-Create And Read File In Php
Use Of File Handling In Php-
File Handling Bhut He Useful Concept Hai Php Mai Me Apko Iska Ek Simple Use Btata Hu Aap File Handling Ka Use Karke Kisi Be Website Ka Phishing Page(Duplicate) Page Bnake Kisi Be User Ki Id Hack Kar Sakte Ho.File Handling Ka Use Hacking Me Be Kiya Jata Hai.
Means Hacker Same To Same Kisi Be Website Ka Phishing Page Create Karte Hai Or Victim Ko Send Karte Hai Victim Use Real Website Samajhkar Jab Wanha Apni Id And Password Dalkar Submit Par Click Karta Hai To Wanha File Handling Ke Write Function(Create A File Function) Ka Use Kiya Jata Jese He User Id And Password Dalkar Login Karta Hai To Ek File Create Ho Jati Hai Hacker Ke Server Par Means Webhosting Me Janha Us File Me Apki Id And Password Ki Sare Detail Hote Hai .Jiska Use Karke Hacker Apki Email Id Ko Hack Kar Sakta Hai.
File Handling Ke Or Be Bhut Se Use Hote Hai Me Apko Mere Ane Wali Post Me Iske Bare Me Detail Me Btaunga Agar Apko Post Se Related Koi Be Problem A Rhe Hai To Aap Mujse Comment Me Puch Sakte Hai Me Apki Puri Sahayta Karne Ki Koshish Karunga
Thank You
Team Gajabwap Web In Hindi
Also Read-
Contact Form Kaise Bnaye-By Using Phpmailer
ConversionConversion EmoticonEmoticon