$imgdata =addslashes (file_get_contents($_files['userfile']['tmp_name'])); $sql = "insert imgexam (image, name) values ('{$imgdata}', '{$_files['userfile']['name']}');";
so have update new image following steps:
- remove old image upload
- new image update row in database to
- the name of new image
how remove old image using php:
unlink('directory/images/'.$image);
you might need selection database right image name.
how upload new image using php: read page more informations on uploading files
then after uploading new image, need change row in database.
how change row in database
$sql = "update `table` set `imagename` = '$newimagename' `imagename` = $oldimagename"; $query = mysql_query($sql) or die(mysql_error());
thats steps need. ask if have problems.
Comments
Post a Comment