1 / 9

File

File. Bayu Priyambadha, S.Kom. File (1). PHP provide some functions to manage file, likes : Open / Close Write / Read Add / append Fopen = for open file Fget = for get entire file. File (2). Try This!!. <? $file = “contoh.txt”; $fp = fopen($file, “r”); while (!feof($fp)) {

kasi
Download Presentation

File

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. File Bayu Priyambadha, S.Kom

  2. File (1) • PHP provide some functions to manage file, likes : • Open / Close • Write / Read • Add / append • Fopen = for open file • Fget = for get entire file

  3. File (2)

  4. Try This!! <? $file = “contoh.txt”; $fp = fopen($file, “r”); while (!feof($fp)) { $baris = fgets($fp, 1024); echo $baris.”<br />”; } fclose($fp); ?>

  5. Try This!! <? $file = “contoh.txt”; $fp = fopen($file, “r”); while (!feof($fp)) { $baris = fread($fp, 30); echo $baris; } fclose($fp); ?>

  6. Try this!! <? $file = “contoh.txt”; $fp = fopen($file, “w”); fwrite($fp, “Menuliskan ke dalam file”); fclose($fp); $fp = fopen($file, “a”); fputs($fp, “Menambahkan ke dalam file”); fclose($fp); $fp = fopen($file, “r”); while (!feof($fp)) { $baris = fgets($fp, 1024); echo $baris; } fclose($fp); ?>

  7. Upload file • Use enctype="multipart/form-data" on html form • Use <input> with type=“file” • $_FILES[field name][atribut] to get file • Atribute : • tmp_name = temporary path where the file will be placed • name = file name • move_uploaded_file() or copy() for move file from temporary path to real destination

  8. TRY THIS!! <?php $user_file = $_FILES[“file_user”][“tmp_name”]; $filename = $_FILES[“file_user”][“name”]; $tujuan = “”; copy($user_file, $tujuan.$filename); ?>

More Related