Page 1 of 1

What php code can support image?

Posted: Tue May 11, 2004 10:46 am
by teckyan888
Let say i create a table call:

Code: Select all

<?php
create table Category(
CategoryID int(20) not null AUTO_INCREMENT,
CategoryName varchar(100) not null,
Description varchar(255) not null,
primary key (CategoryID)
);

?>
Then i wan to upload the image for everytime i insert the new data into my table,what should i do? And also can delete the image when i delete the data at the same time...
Anyone who know that?

Posted: Tue May 11, 2004 10:54 am
by markl999
Just have a field of varchar(100) or whatever to store the image name, and leave the image on the filesystem as nature intended ;)
When you are deleting the entry from the db you could first grab the image name, then delete the row from the db, then delete the image from the filesystem (maybe use http://php.net/unlink to do it).

Posted: Tue May 11, 2004 11:10 am
by teckyan888
Ok...i try first...Thanks