Also add a wrapper for file import that enforces a post id to attach it to. This should keep a neater organization into year folders in upload.
I also added one more extra check so we get fewer file not found errors.
It helps to import a file which has a different extension (e.g. .blob instead of .jpeg, missing .pdf, etc).
How to test
try calling both import_external_file() and import_attachment_for_post() including the $desired_filename argument on a file that you've changed the file extension to something like .notallowed and verify that you get the file downloaded correctly.
Also add a wrapper for file import that enforces a post id to attach it to. This should keep a neater organization into year folders in upload.
I also added one more extra check so we get fewer file not found errors.
It helps to import a file which has a different extension (e.g. .blob instead of .jpeg, missing .pdf, etc).
How to test
import_external_file()
andimport_attachment_for_post()
including the$desired_filename
argument on a file that you've changed the file extension to something like.notallowed
and verify that you get the file downloaded correctly.