Code:
<form enctype="multipart/form-data" action="addpicture.php" method="post">
Select Photo<br />
<input type="file" name="upfile"> <p>
<input type="image" src="submit.jpg" border="0" name="submit">
<input type="hidden" name="cat_id" value="<?php echo $row['cat_id']; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<?
<form enctype="multipart/form-data" action="addpicture.php" method="post">
Select Photo<br />
<input type="file" name="upfile"> <p>
<input type="image" src="submit.jpg" border="0" name="submit">
<input type="hidden" name="cat_id" value="<?php echo $row['cat_id']; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<?
ovo je prvi djelic koda a drugi je ovo
Code:
if ((isset ($_POST['submit'])) || (isset($_POST['submit_x'])))
{
include "db_connect.php";
$result = mysql_query("select * from categories where cat_id ='{$_POST["cat_id"]}'") or
die (mysql_error());
$row = mysql_fetch_assoc($result);
$category = $row["cat_title"];
$gallery = "/home/r4334/public_html/vfaPublishing/gallery/";
$upload_dir1 = $gallery . $category;
$upload_dir = $upload_dir1 . "/";
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $upload_dir . $_FILES['upfile']['name']))
{
$title = $_FILES['upfile']['name'];
echo $title;
$huh = $_POST['upfile'];
$poss=strrpos($huh,"/");
$huhs=substr($huh,$poss+1);
//INSERT INTO `images` ( `image_id` , `cat_id` , `image_title` , `image_url` ) VALUES ('', '2', 'sdf', 'ads');
$query = mysql_query("INSERT INTO `images` ( `image_id` , `cat_id` , `image_title` , `image_url` ) VALUES ('', '{$_POST["cat_id"]}', '$huhs', '$poss')") or
die (mysql_error());
$page = $_POST["page"];
}
else
{
echo "DAMN IT";
}
if ((isset ($_POST['submit'])) || (isset($_POST['submit_x'])))
{
include "db_connect.php";
$result = mysql_query("select * from categories where cat_id ='{$_POST["cat_id"]}'") or
die (mysql_error());
$row = mysql_fetch_assoc($result);
$category = $row["cat_title"];
$gallery = "/home/r4334/public_html/vfaPublishing/gallery/";
$upload_dir1 = $gallery . $category;
$upload_dir = $upload_dir1 . "/";
if (move_uploaded_file($_FILES['upfile']['tmp_name'], $upload_dir . $_FILES['upfile']['name']))
{
$title = $_FILES['upfile']['name'];
echo $title;
$huh = $_POST['upfile'];
$poss=strrpos($huh,"/");
$huhs=substr($huh,$poss+1);
//INSERT INTO `images` ( `image_id` , `cat_id` , `image_title` , `image_url` ) VALUES ('', '2', 'sdf', 'ads');
$query = mysql_query("INSERT INTO `images` ( `image_id` , `cat_id` , `image_title` , `image_url` ) VALUES ('', '{$_POST["cat_id"]}', '$huhs', '$poss')") or
die (mysql_error());
$page = $_POST["page"];
}
else
{
echo "DAMN IT";
}
ima dosta stvari koje sam jos kod obradjivanja uradio...
Sta mi nije jasno i error koji dobijam je sledeci..
Code:
Warning: move_uploaded_file(/home/r4334/public_html/vfaPublishing/gallery/Waterfalls Gallery/12.JPG): failed to open stream: Permission denied in /home/r4334/public_html/admin/addpicture.php on line 62
Warning: move_uploaded_file(): Unable to move '/tmp/phpdOAptS' to '/home/r4334/public_html/vfaPublishing/gallery/Waterfalls Gallery/12.JPG' in /home/r4334/public_html/admin/addpicture.php on line 62
DAMN IT
Warning: move_uploaded_file(/home/r4334/public_html/vfaPublishing/gallery/Waterfalls Gallery/12.JPG): failed to open stream: Permission denied in /home/r4334/public_html/admin/addpicture.php on line 62
Warning: move_uploaded_file(): Unable to move '/tmp/phpdOAptS' to '/home/r4334/public_html/vfaPublishing/gallery/Waterfalls Gallery/12.JPG' in /home/r4334/public_html/admin/addpicture.php on line 62
DAMN IT
gallery folder mi je chomd-ovan na 777 i ne vidim razlog zasto nece da pise po njemu?
Da li neko ima predlog.