How to save the file to my server?
Date: 12/29/06
(PHP Community) Keywords: database
Hello! Can anyone help me with saving the file to it server? Because currently i manage to upload the file into my database but not to the server itself. I know i have to use a function known as the move_upload_file but i'm uncertain how on how i can move it to this directory C:\Program Files\mysite\images. Please help! thanks a lot for the help. :)
0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
move_uploaded_file($fileName,$tmpName);
$filename= "\Inetpub\wwwroot\tpi\images\$fileName"; //?? this is the part i'm facing
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$query = "INSERT INTO languages (name) ".
"VALUES ('$fileName')";
mysql_query($query) or die('Error, query failed');
echo "
File $fileName uploaded
";
}
?>
Source: http://community.livejournal.com/php/526096.html