You are here: issues writing a image path to mysql database « PHP Programming Language « IT news, forums, messages
issues writing a image path to mysql database

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация