I hoping someone can help out with loading images to appear in a PHP form. I have the code below, nd I am getting the "broken image" icon after I attempt to upload.
Mt 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!
add.php3
...
<P><STRONG>Photo:</STRONG><BR>
<INPUT TYPE="file" NAME="tempimages" SIZE=35 MAXLENGTH=75>
...
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.");
...
<P><STRONG>Photo:</STRONG><BR>
<? echo "$photoname"; ?></P>
<?
{
exec("cp $tempimages /home/usaautoland/www/images/$photoname");
echo "temp file: $tempimages<br>\n";
echo "file name: $photoname<br>\n";
echo "file size: $picture_size<br>\n";
echo "file type: $picture_type<br>\n";
echo "<br>\n";
echo "<img src=images/$photoname><br>\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 = @mysql_query($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/usaautoland/www/$photoname") or die ("Couldn't copy the file.");
} else {
die("No input file specified");
}
?>