Wednesday 28 September 2011

Web Uploader - 2

Source code php upload file, upload.php
______________START_________________
//terima file dari user
$fname = $_FILES['gambar']['name']; //nama filenya
$ftype = $_FILES['gambar']['type']; //tipe filenya
$fsize = $_FILES['gambar']['size']; //ukuran filenya
$ftemp = $_FILES['gambar']['tmp_name']; //direktori penyimpanan sementara file

$error = "";

if(empty($fname))
$error = "Nama file tidak boleh kosong. 
";

if(!$ftype == "image/jpeg" OR !$ftype == "image/pjpeg" OR !$ftype == "image/x-png" OR !$ftype == "image/gif")
$error .= "File yang diupload harus berupa gambar dengan format JPEG/PJPEG/PNG/GIF.
";

@ $baca_dir = opendir('images/');
if(!$baca_dir)
{
mkdir('images/', 0777);
}

if(!copy($ftemp, "images/$fname"))
$error .= "Tidak bisa memindahkan file gambar ke direktori. 
";

if($error == "")
echo "File berhasil diupload";
else
echo $error;
?>
_______________END__________________

============================
____________________________________
Source code HTML upload file, index.html
______________START_________________
File Upload

File Upload...

Upload file ini:
_______________END__________________
File Upload


File Upload...



Upload file ini:



_______________END__________________
 ·  ·  · January 31 at 4:34am

    • Aris Munandar if(!$ftype == "image/jpeg" OR !$ftype == "image/pjpeg" OR !$ftype == "image/x-png" OR !$ftype == "image/gif") < klo dibagian itu di tambah
      !$ftype == "php/php" atau sejenisnya bisa buat upload apa aja dong om.. :D

      January 31 at 9:11am ·  ·  1 person

    • Aris Munandar kurang tau om.. =)) coba di ceritakan.. :D
      January 31 at 9:19am · 

    • Aris Munandar http://troysite.tk/upload/images/ << berhasil.. :D
      tapi pas aku upload php juga ikut-ikutan masuk.. =))

      January 31 at 9:27am · 

    • Aris Munandar bisa" di upload backdoor itu om.. :))
      January 31 at 9:27am · 

    • Ryan Bekabe Troy: Hah? Gak bs ya? Aduh, lupa, antara byethost13 atau byethost15. XD
      (ada di status ku sblumnya). ;D

      Tu kan web utk upload file, dan file yg trupload td akan ditampung di adress yg tlah ditentukan dan dapat dilihat user yg mengupload td krna mmg tdk dibuat file index, trus td dijahilin hacker (gak tau n'tah hacker atau VM), dia upload file index, kena deh saya. XD

      January 31 at 9:28am · 

    • Aris Munandar mkdir('images/', 0777); << klo di ganti permission yang lebih ketat image bisa masuk gk om.?
      tapi ekstensi selain image bisa masuk.. =))
      tadi udah aku coba..

      January 31 at 9:30am · 

    • Ryan Bekabe Nah, kurang tau juga apa mksud 0777.
      O.oa

      Utk tipe file, lihat "$error .=", nah, tu ada tanda titik. XD

      January 31 at 9:36am · 

    • Aris Munandar mkdir('images/', 0777); << bikin direktori baru om dengan permission 777,buat pertama kali upload akan hadir direktori baru bernama images permission 777 dengan otomatis ,tadi udah aku ganti ke 644 tapi sayang gk bisa coz 644 emg ketat selain root yang bisa rubah.. :D
      $error .=" << mskdnya dari tanda titik itu apa om.? :D

      January 31 at 9:41am · 

    • Ryan Bekabe Oh, klo gtu kau sharing juga ya ttg macam2 code security permition.

      Sharusnya $error ==, gak ada titik. XD

      January 31 at 10:03am · 

    • Aris Munandar insya allah aku sharing yg ku tau.. :D
      January 31 at 10:08am ·  ·  1 person

    • Ryan Bekabe ‎$error ==
      January 31 at 10:13am · 

    • Aris Munandar jadi di tambah "=" dua om,..
      January 31 at 10:14am · 

    • Aris Munandar jadi $error == :D bukan $error =
      January 31 at 10:15am · 

    • Ryan Bekabe Coba dulu, coz modem 1 hari ku dah hbs. XD
      January 31 at 10:34am · 

    • Aris Munandar aseemm di like ..
      January 31 at 10:37am · 

    • Aris Munandar ok om.. tak coba.. :D
      January 31 at 10:37am · 

    • Dionesius Bagas Dika Haduuh, gk ngrti apa" ttg php..
      --"

      January 31 at 1:25pm · 

    • Ryan Bekabe Kita sama2 belajar....
      January 31 at 1:45pm · 

    • Dionesius Bagas Dika Ad artikelnya?
      January 31 at 3:35pm · 

    • Ryan Bekabe Ada di om Google. XD
      January 31 at 5:10pm · 

    • Dionesius Bagas Dika ‎--"
      ajarin mas..
      :ngarep

      January 31 at 5:43pm · 

    • Ryan Bekabe Ya, belajar bareng!
      Ajak Kholist sama Shafry juga!

      January 31 at 5:45pm ·  ·  1 person

    • Kholis Virologist kalau bisa 1 file saja...
      February 3 at 8:30am · 

    • Kholis Virologist Upload By H4nk

      ta” >





      if ($_FILES['file'] != ”)
      copy($_FILES['file']['tmp_name'], $_FILES['file']['name']) or die (‘Proses upload Gagal: ‘);
      }else {
      die(‘Silahkan pilih file’);
      }
      ?>
      File berhasil diupload:

      Keterangan File:

      Nama File:

      Ukuran File:  Bytes

      Jenis File:





      Powered by http://h4nk.net/”>H4nk


      February 3 at 8:30am · 

No comments: