addproduct.php snippet (there are lots of other inputs, not sure if that matters):
<form method="POST" action="add.php" enctype="multipart/form-data">
<p>Picture:<input type="file" id="pic_upload" name="pic" />
<input type="submit" />
</form>
add.php:
if(isset($_FILES["pic"]))
{
if($_FILES["pic"]["error"]==0)
{
$name = explode(".",basename($_FILES["pic"]["name"]));
$target = realpath(dirname($_SERVER['PHP_SELF']))."/images/".$name[0].session_id().".".$name[1];
$temp = $name[0].session_id().".".$name[1];
if(!move_uploaded_file($_FILES["pic"]["tmp_name"],$target))
{
add_error("Picture specified did not upload");
}
$_POST['pic']=$temp;
}
else
{
add_error("Picture specified did not upload correctly");
}
}
error:
Warning: move_uploaded_file(/images/Adult_Bobcatb6b8d5749abe65888cfa89200da5bdb4.jpg): failed to open stream: No such file or directory in /u/students/j/j.d.dancks/public_html/onestopshop/add.php on line 52
Warning: move_uploaded_file(): Unable to move '/tmp/phpiRN9EP' to '/images/Adult_Bobcatb6b8d5749abe65888cfa89200da5bdb4.jpg' in /u/students/j/j.d.dancks/public_html/onestopshop/add.php on line 52
Warning: Cannot modify header information - headers already sent by (output started at /u/students/j/j.d.dancks/public_html/onestopshop/add.php:52) in /u/students/j/j.d.dancks/public_html/onestopshop/add.php on line 148
Any ideas what I did wrong?