Hello.
Just a while ago I did an upload photo script for my daily practice. I did one, however, it won't rename the uploaded photo into unique say something using like time(). Can someone help me?
this is the script that inserts the filename to the database so that I will just call its path.
<?php
session_start();
include 'db_connect.php';
$photo = $_POST['img_src'];
$username = $_SESSION['username'];
$now = time();
$src = "members_photo/".$now.$photo;
$sqlup = "UPDATE users SET photo='$src' WHERE username='$username'";
$result1=mysql_query($sqlup);
unset($_SESSION['photo']);
$sql1="SELECT * FROM users WHERE username='$username'";
$result1=mysql_query($sql1);
echo mysql_error();
while($rows=mysql_fetch_array($result1)){
$_SESSION['photo'] = $rows['photo'];
}
echo "updated";
?>