I hoping someone can help out with loading images to appear in a PHP form. I'm getting the "broken image" icon after I upload a photo from my local drive, and this also does not seem to upload the filename to MySQL. I have myy code below.
I have the form to upload with the data, a "verification" page, and the final 'record' page. My temporay image folder is called "tempimages", and the filename is "photoname" in MySQL. I also believe I have the php.ini file set correctly, so I think there is an error somehere in the code.
Anyones help would be appreciated! Thank You!
verifyadd.php3
...
$sql = "INSERT INTO $table_name
(id, stock, year, make, model, vin, milage, color, engine, trans, options, description, price, photoname)
VALUES
(\"\",
\"$stock\", \"$year\", \"$make\", \"$model\", \"$vin\", \"$milage\", \"$color\", \"$engine\", \"$trans\", \"$options\", \"$description\", \"$price\", \"$photoname\")
";
$result = @($sql,$connection) or die("Couldn't execute query.");
...
Photo:
{
exec("cp $tempimages /home/domain/www/images/$photoname");
echo "temp file: $tempimages
\n";
echo "file name: $photoname
\n";
echo "file size: $picture_size
\n";
echo "file type: $picture_type
\n";
echo "
\n";
echo "
\n";
}
...
record.php3
...
else {
$sql = "SELECT stock, year, make, model, vin, milage, color, engine, trans, options, description, price, photoname
FROM $table_name
WHERE id = \"$id\"
";
$result = @($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$stock = $row['stock'];
$year = $row['year'];
$make = $row['make'];
$model = $row['model'];
$vin = $row['vin'];
$milage = $row['milage'];
$color = $row['color'];
$engine = $row['engine'];
$trans = $row['trans'];
$options = $row['options'];
$description = $row['description'];
$price = $row['price'];
$photoname = $row['photoname'];
}
}
...
if ($photoname != "") {
@copy("$tempimages", "/home/domain/www/$photoname") or die ("Couldn't copy the file.");
} else {
die("No input file specified");
}
?>