Cek the following codes. It suppose to copy and paste the pictures - to folder photos/ . Yet, I haven't seen the message: "sucess copy file to photos" appears. only, "Data telah tersimpan" or "Successfully saving data to database".
//Save Picture
if (isset($_REQUEST['ok'])){
if (empty($_REQUEST['id']))
{
$sqlstr = "INSERT INTO gallery(judul, image) VALUES('".$judul."','".$image."')";
// copy pictures to photos
if($_FILES['image']['error'] == 0){
// success - move uploaded file
$uploads_dir = '/photos';
$name = $_FILES["pictures"]["name"];
move_uploaded_file($tmp_name, "$uploads_dir/$name");
echo "sucess copy file to photos";
}else{
// 'there was an error uploading file' stuff here....
echo "error uploading file";
}
}
else
$sqlstr = "UPDATE gallery SET judul='".$judul."', image='".$image."' WHERE id=".$_REQUEST['id'];
$result = mysql_query($sqlstr) or die(mysql_error());
//Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
//if (empty($_REQUEST['id'])) kirimEmail($idKategori, $judul, $news);
$confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";
}