ive spent 2 days trying to get this to work and im almost bald and very sore due to frustration
im tring to u/l an image and store the file name in mySQL, so far i have managed to get the file to u/l and be copied to the /images dir (CHMOD 777) and i have also managed to get the data into mySQL but i cant get it to do both these tasks simulatniousy...
please help..
its probably very simple.. im a baby php'r
<?php
if ($submit) {
// process form
$db = mysql_connect("localhost", "xxxxxx", "xxxxxx");
mysql_select_db("test",$db);
$sql = "INSERT INTO employees (first,last,address,position,picture_name,picture_title) VALUES ('$first','$last','$address','$position','$picture','$title')";
$result = mysql_query($sql);
exec("cp $picture /home/thewomb/www/www/www.thewomb.co.uk/images/$picture_name");
echo "temp file: $picture<br>\n";
echo "file name: $picture_name<br>\n";
echo "file size: $picture_size<br>\n";
echo "file type: $picture_type<br>\n";
echo "<br>\n";
echo "<img src=images/$picture_name><br>\n";
echo "Thank you! Information entered.\n";
} else{
// display form
?>