Here is my input field..
<input type="file" name="upload_file[]" value="" id=" "/>
$attach = $_FILES["upload_file[]"]["name"];
$sql = "insert into uploadfile(CAT_ID, SUB_CAT_ID, TAG, DESCRIPTION, UF_NAME, UF_NAME1 , GENRE) values('".$category."','".$subcategory."','".$tag."','".$optionaldescription."','".$attach."','".$attach."','".$genre."')";
copy($_FILES['upload_file[]']['tmp_name'], "upload/".$_FILES['upload_file']['name']);
mysql_query($sql);
Warning: copy() [function.copy]: Filename cannot be empty in C:\xampp\htdocs\test\index.php on line 48
PHP automatically converts HTML form elements that end in
[]to arrays, therefore, access the0nt element of the array:In addition, you should be using
move_uploaded_file()in place ofcopy().