Im creating a social network site and i was able to create a user folder each time a new user signs up but my problem is copying a default image from a folder to that user folder how can i do that? I've searched the web on solutions like using Copy function in php but itsn't working
You can check my code and i would be glad if anyone could help:
<?php
$link= mysqli_connect("localhost","root","","new1");
if($link === false)
{
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$firstname = $_POST["firstname"];
$lastname = $_POST["lastname"];
$username= $_POST["username"];
$email = $_POST["Email"];
$password= $_POST["Password"];
$country= $_POST["Country"];
$gender= $_POST["Gender"];
$birthday= $_POST["birthday"];
$profilepicture= "default.gif";
$sql = "INSERT INTO 360tery (firstname, lastname, username,Email,Password,Country,Gender,birthday,Profilepicture) VALUES ('$firstname','$lastname','$username','$email','$password','$country','$gender','$birthday','$profilepicture')";
$result = mysqli_query($link, $sql);
if ($result)
{
session_start();
$_SESSION['email']= $email;
echo "<script type='text/javascript'>alert('Successfully Registerd!'); window.location.href='../html/updatedtimeline.html';</script>";
mkdir("../html/users/".$username,0777);
$defaultimagepath='../photos/default.gif'; //This is the path to my default image
$userfilepath="../html/users/".$username."/"; //the path to the users file i want to copy image to
copy($defaultimagepath,$userfilepath); //copy function
}else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
?>