picture into mysql (file address)
| From: | Seabird | Date: | Wed, 18 Dec 2002 20:20:24 +0000 |
| Subject: | picture into mysql (file address) | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-24272@lists.php.net to get a copy of this message | ||
Hi everyone, I have been struggeling with this for some time know and don't
know where it goes wrong. I want to upload pictures into a folder AND store
their path into MySQL. I used a joe's auto tutorial but can't get it to
work. All the information is put in correctly but not the picture.
Please help me, here's my code: (ps globals are off)
if ($_POST[submit]) {
$link = mysql_pconnect("localhost","myusername","mypassword");
$db = test;
mysql_select_db($db,$link);
$query = "INSERT INTO inventory
(registration,type,total_time,price,description,picture_name)
VALUES
('$_POST[registration]','$_POST[type]','$_POST[total_time]','$_POST[price]',
'$_POST[description]','$_POST[picture]')";
exec("cp $_POST[picture]
//localhost/seabird.jmtech.ca/OTF.com/images/$_POST[picture_name]");
mysql_query( $query, $link);
print 'Thank you<br>You have submitted the following information:<br>';
echo "Registration: $_POST[registration]<br>\n";
echo "Type: $_POST[type]<br>\n";
echo "Total Time: $_POST[total_time]<br>\n";
echo "Price: $_POST[price]<br>\n";
echo "Description: $_POST[description]<br>\n";
echo "temp file: $_POST[picture]<br>\n";
echo "file name: $_POST[picture_name]<br>\n";
echo "file size: $_POST[picture_size]<br>\n";
echo "file type: $_POST[picture_type]<br>\n";
echo "<br>\n";
echo "<img src=images/$picture_name><br>\n";
}
else { ?>
<form enctype="multipart/form-data" method="post"
action="<?php echo $PHP_SELF ?>">
<p>Registration<br>
<input type="Text" name="registration" size="25"
value="N">
<br>
type<br>
<input type="Text" name="type" size="25">
<br>
total time<br>
<input type="Text" name="total_time" size="25">
<br>
price<br>
<input type="Text" name="price" size="25">
<br>
Description<br>
<textarea name="description"></textarea>
<br>
picture<br>
<input type="file" name="picture" size="25">
<input type="submit" name="submit" value="Upload">
</p>
</form>
--
http://seabird.jmtech.ca
Attitude is Everything!
But Remember, Attitudes are Contagious!
Is Yours worth Catching????