What are the potential issues with integrating a file upload feature with a database in PHP?

One potential issue with integrating a file upload feature with a database in PHP is handling file storage efficiently. It is not recommended to store files directly in the database due to performance and scalability concerns. Instead, a common approach is to store the file in a directory on the server and store the file path in the database.

// Sample code to handle file upload and store file path in database

// Check if file is uploaded
if(isset($_FILES['file'])){
    $file_name = $_FILES['file']['name'];
    $file_tmp = $_FILES['file']['tmp_name'];
    
    // Move file to desired directory
    move_uploaded_file($file_tmp, 'uploads/' . $file_name);
    
    // Store file path in database
    $file_path = 'uploads/' . $file_name;
    $query = "INSERT INTO files (file_path) VALUES ('$file_path')";
    // Execute query
}