What security rules of browsers might prevent saving network file paths in a database using PHP/MySQL?

Browsers have security restrictions in place that prevent saving network file paths in a database for privacy and security reasons. To work around this limitation, you can use PHP to upload the file to the server and save the file path instead of the network file path in the database.

// Upload file to server
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);

// Save file path to database
$file_path = $target_file;
$query = "INSERT INTO files (file_path) VALUES ('$file_path')";
// Execute query to save file path to database