I would like to know if its possible to add title of the article to file name when uploading it ?
Example: I am uploading files with simple code
$directory = '../images/adds/';
$temp_file = $directory . basename($_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $temp_file)) {
echo "<p style='color:#1dff03;'>file uploaded.</p>";
}
else{
echo "<p style='color:#f00;'>File cant be uploaded.</p>";
}
I am saving file name in database with title : my-article-name-filename.png but cant upload to server with article title, is it possible to get some help?