Hi guys,
I am trying to upload a picture through an HTML form, display it to the user and then put either it, or the path to it into a database. The form seems to be working, and the photo's name is formPhoto. Here is my php code:
<?php
if ( isset($_FILES['formPhoto']) )
{
$path_parts = pathinfo(postAd3.php);
#$dir = $path_parts['dirname'] . "\img";
$dir = ".\\websites\\fyiguide\\img";
$uniq = uniqid("");
$file_ext = $_FILES['type'];
$filename = $dir . "\\" . $uniq . "." . $file_ext;
if(move_uploaded_file($_FILES['tmp_name'], $filename))
{
echo("file uploaded");
}
else
{
echo("messed up on" . $filename . " file extention is $file_ext");
}
echo("<p>trying this: -- </p>");
}
else
{
echo("No file was selected");
exit();
}
?>
This script fails when I use the Move_Uploaded_file function ... can anyone point me in the right direction? I want the files deposited in the img folder on my webserver, which for me is websites/fyiguide/img where /fyiguide is where all my web files are located. I'm not running the server, so I have limited information, but at the ssh prompt when I type cd ./ I get to /www outside of the websites directory.
Is there any more info I need to post? Thanks in advance guys - this is driving me crazy.
Matt