|
Posted by Glenn Coyle on 10/03/06 12:13
Hi
I am having trouble writing the file path of a image to the
database,also for some reason it is not uploading the images, anyone
have any ideas?
the code is below:
if($_POST[Submit] == 'Submit')
{
$target_path = "../reviewImages/";
$target_path = $target_path . basename(
$_FILES['uploadFile']['name']);
if(move_uploaded_file($_FILES['uploadFile']['tmp_name'],
$target_path)) {
echo "The file ". basename( $_FILES['uploadFile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try
again!";
}
echo $target_path;
$text = $_POST[text];
$press = $_POST[press];
$logo = "reviewImages/".basename( $_FILES['uploadFile']['name']);
echo $logo;
$title = $_POST[title];
$author = $_POST[author];
$date = $_POST['date'];
$sql = "INSERT into reviews (press, title, author, date, text,
imagePath) VALUES ('$press', '$title', '$author', '$date', '$text',
'$logo')";
mysql_query($sql) or die(mysql_error());
echo "Information added to the reviews table";
}
cheers
Glenn
Navigation:
[Reply to this message]
|