Im stuck on a problem,
I have created a multiply uploader, it works fine until i want the file I upload to register the name inside a database, The error message I get is
Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in C:\wamp\www\bookstyled\profile.php on line 16
My line 16 is the variable file_name
$file_name = mysql_real_escape_string($_FILES['file_name']['name']);
If I remove the mysql_real_escape_string, It actually save to the database but not as the file name, but its says " Array "
This is some of the code
if(isset($_FILES['file_name'])) {
foreach ($_FILES['file_name'] ['tmp_name'] as $key => $tmp_name){
$file_name = mysql_real_escape_string($_FILES['file_name']['name']);
$dt1=date('y-m-d H:m:s');
$ip=$_SERVER['REMOTE_ADDR'];
mysql_query("INSERT INTO `files` (`file_name`, `user_name`,`file_time`,`file_ip`) VALUES ('$file_name', '{$_SESSION['username']}','$dt1','$ip')") ;
move_uploaded_file($tmp_name, "core/files/{$_FILES['file_name']['name'][$key]}");
}
}
And If I didn't mention it The files are being upload.
Thanks