1

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.

  1. 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.

  2. 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.

  1. I am looking if anyone knows how I can send the file location and not field name if possible for do_upload().

  2. Is there a way to trigger folder sync from add on for user not authenticated.

  3. Any other ideas on best practice for this.

Thanks

Running EE 3.5.6

  • Maybe filemanager class is something you are looking for. It will have everything you need. – Mufi - Amici Infotech Aug 16 '18 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.