aris1234 Posted June 12, 2007 Share Posted June 12, 2007 How to rename file name in DB...??? this my code, but this code only save image to folder, can't rename file in DB : <?php //Сheck that we have a file $folder = "../property/$spid"; if(!file_exists($folder)) { mkdir($folder); } $sql = "UPDATE `$table` SET str_image1='$simage1' WHERE int_prop_ID='$spid'"; } if(mysql_query($sql, $conn) == false) { exit(mysql_error()); } else { $property_id = mysql_insert_id(); } // Process image for($i = 0; $i < count($_FILES["file"]["name"]); $i++) { // Update row $filename = $_FILES["file"]["name"][$i]; $sql = "UPDATE properties ". "SET str_image". ($i + 1) ."= '$filename' ". "WHERE int_prop_ID = $property_id "; mysql_query($sql, $conn); // Move file $tmp_filename = $_FILES["file"]["tmp_name"][$i]; move_uploaded_file($tmp_filename, $folder ."/". $filename); } header( 'Location: view.php' ); ?> Quote Link to comment https://forums.phpfreaks.com/topic/55217-how-to-rename-file-name-in-db/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.