I use the code below and it works correctly, however I need to change the name of the image during UPLOAD.
<?php require_once('conexao.php'); ?>
<?php
$cliente = $_GET['cliente'];
$cod = $_GET['cod'];
$uploaddir = "./clientes/".$cliente."/".$cod."/";
$file = $uploaddir . basename($_FILES['uploadfile']['name']);
$imvfoto = $_FILES['uploadfile']['name'];
$sqlgravar="INSERT INTO fotos(cod,cliente,foto)
VALUES ('$cod','$cliente','$imvfoto')";
$resultadogravar = mysql_query($sqlgravar)
or die (mysql_error());
if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) {
echo "success";
} else {
echo "error";
}
include("resize-class.php");
$resizeObj = new resize("/home/roteirodoimovelc/public_html/cp/clientes/".$cliente."/".$cod."/".$imvfoto."");
// *** 2) Resize image (options: exact, portrait, landscape, auto, crop)
$resizeObj -> resizeImage(600, 450, 'exact');
$resizeObj -> saveImage("/home/roteirodoimovelc/public_html/cp/clientes/".$cliente."/".$cod."/".$imvfoto."", 100);
?>
How do I make this implementation so that the photo is renamed and saved on the server and also in the database?