Kenneth,
I store the path to the image in the table. I am unsure if you can actually
write an image to a table.
When the item is deleted, I run an "exec" command to remove the actual file.
Here's some snippets:
The actual html to create the upload file text box within a <form>:
<INPUT type="file" name="picture" size=30>
This is the code for the page that is called using the form action. I added
a timestamp to the filename to avoid anyone accidentially overwriting a
file. (and hacking - you know a picture of a naked lady where a picture of a
garden rack is supposed to be):
// Creates the image file with a timestamp
$timestamp = time();
$image= $timestamp.$picture_name;
exec("mv $picture /path/to/your/directory/$image");
The "exec" command is what you really want to pay attenetion to. Also, this
example is assuming you are running Linux and MySQL. This is the delete
routine that removes the file and the record from the table:
//Remove File from server
$sol_1 = "SELECT * FROM featured WHERE image = '$sell_record'";
$sol_result = myself_query($sol_1, $connection) or die ("SQL_RESULT");
$row = myself_fetch_array($sol_result) or die ("Couldn't execute $sol_1");
$image = $row["image"];
exec("rm $picture /path/to/your/directory/'$image'");
Please note that you must use the actual path to the directory, not the
httpd path. I hope this helps you. Let me know.....
Shane
----- Original Message -----
From: "Kenneth R Zink II" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Friday, January 12, 2001 4:35 PM
Subject: [PHP] How do I store a pic?
> How do I store a jpg within a table?
>
> I want for a user to be able to pull a jpg from either their HD and store
it
> in a table with some other information for a classifieds section. That
way
> when the ad is deleted, the picture goes with it instead of remaining on
my
> HD.
>
> Kenneth R Zink II [EMAIL PROTECTED] ICQ# 5095094
> '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!!
> http://www.s-series.org/htm/windstorm/project-windstorm.htm
> '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS
!!!
> http://www.s-series.org/htm/firestorm/firestorm.htm
> Racing by the Grace of God!!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]