I am writing a plugin that will take files that have already been uploaded via ftp to the server and I want to move them with the file upload class so they get added to the database and put into the correct directory which is not where they are originally uploaded via ftp. Currently this is a manual process and I am trying to automate it as it happens a couple of times a week.
I see main ways of potentially doing this.
Using the file upload class. My issue here is I want to pass in the current location of the file to ee()->upload->do_upload() but it looks like I can only pass the field name as if the file is coming as a post request. The only work around there I see is to take the file and do a curl post request where I do the upload. Hoping not to have to go that route as it seems more like a hack.
I could manually move the files which is easy enough but I need to do a folder upload folder sync which is something I see you can do from the admin gui but I have not see a way to do it from within a plugin. I am guessing once again I could do a curl request to run that process but I am guessing the user has to be authenticated and I want this to run as a cron so their will not be a user logged in when it runs.
Questions I have.
I am looking if anyone knows how I can send the file location and not field name if possible for do_upload().
Is there a way to trigger folder sync from add on for user not authenticated.
Any other ideas on best practice for this.
Running EE 3.5.6