I have manually added some files to the Private Files directory on my Drupal 7 site and wish to add them to the
file_managed table in the database.
This is what I have attempted:
- Load the existing file with the file_get_contents($PATH_TO_FILE) function.
- Used the file_save_data($loaded_file, $destination, FILE_EXISTING_REPLACE) function save the file and add it to the Database.
- The expected file is in the File System but is 0 bytes and blank
- File is added to Database
The main issue is that the existing file isn't getting uploaded properly and is being displayed blank. How can I fix this?