hello,
I have this script below that is suppose to upload a file and update the database. well it works with the database fine but it wont upload files to the webserver. I have my own webserver on my pc I use to test the scripts and it works fine but when I upload it to the live server the uploading doesnt work Please let me know thank you.
session_start();
//open the database
include("../forms/open_config.php");
//check to see if the person trying to view page is logged in
if(!isset($_SESSION['pdflogin'])) {
header("Location:http://www.sono-tek.com/pdf_download/pdfupdatelogin.php");
}
if(isset($_POST['upload'])) {
$language = $_POST['language'];
$category = $_POST['category'];
$product = $_POST['product'];
$description = $_POST['description'];
$target_path .= "/public_html/sono-tek.com/pdf_download/";
$target_path = $language;
$target_path .= "/";
$target_path .= $product;
$target_path .= "/";
$file_path = $language;
$file_path .= "/";
$file_path .= $product;
$file_path .= "/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$filename = basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded to ". $file_path;
} else{
echo "There was an error uploading the file, please try again!";
}
mysql_query("INSERT INTO pdf_reference (language, category, product, description, file_name, file_path) VALUES ('$language','$category','$product','$description','$filename','$file_path')");
}
//if signout was hit go back to login
if(isset($_POST['signout'])) {
session_unregister('pdflogin');
header("location:http://www.sono-tek.com/pdf_download/pdfupdatelogin.php");
}
?>