Fondix

Syntax upload photo on php 5

Mei 10, 2008 · Tinggalkan sebuah Komentar

$uploaddir = ‘./images/’;
$uploadfile = $uploaddir. $_FILES['gambar1']['name'];
$uploadPath = $_FILES['gambar1']['name'];

if (move_uploaded_file($_FILES['gambar1']['tmp_name'], $uploadfile))
{
//echo “File sudah sukses diupload ke server pada folder dan nama file $uploadfile<br>”;

$str = “INSERT INTO `photo` ( `id` , `nama` , `photo` , `tanggal` )
VALUES (’$idnya’,'$name1′,’$uploadPath’, ”)”;

$qry = mysql_query($str);

}

else
{
//echo “Proses upload gagal, kode error = ” . $_FILES['gambar1']['error'];
}

semoga coding ini membantu anda, kalau masih bingung buka www.php.net atau forum-forum  php

fondix

Kategori: PHP

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Tinggalkan sebuah Komentar