This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
2. Write a php code to complete programmer. Copying, Rename, Write and Append file.
$file_length=filesize($filename);$msg= "<br>File created at $filename<br>";$msg.="containing $file_length bytes";echo $msg;
}else
echo "unble to create file";?>
</body></html>
AT MY DESKTOP
Before
Run The Copy Code With Xampp
AT MY DESKTOP
After
d. appendfile.php
PHP Code
<?php $filename = 'C:\Users\amanoren\Desktop\newFile.txt';$string = file_get_contents($filename);$string .=" Jabatan Teknologi Maklumat dan Komunikasi, Politeknik Ungku Omar, Jalan Raja Musa Mahadi, 31400, Ipoh";file_put_contents($filename, $string);$whatsinthefile = file_get_contents($filename);echo ($whatsinthefile);?><html><head><title>Append files</title></head><body><?php
if(file_exists($filename)){
$file_length=filesize($filename);$msg= "<br>File created at $filename<br>";$msg.="containing $file_length bytes";echo $msg;