I am trying to upload a file to another server using CURL…Here’s the script that uploads the file from the input server. How do I create the script on the receiving server? For example, I need to move the uploaded file into a folder.
Two things come to mind off the top of my head. They could be complete nonsense, but here goes.
Your uploading script on server A could call a script on the other server (B) and use URL vars to trigger the remote script. I’ve never tried this with curl, so I have no idea if it will work.
For instance, your script on server B (the server being uploaded to) could have a line such as: if($_GET[‘uploaded’] == true && file_exists($path_to_file)) which then triggers the script to move the uploaded file.
Or, instead of using curl to trigger the script, you could issue a header redirect after the script has finished uploading, which will then trigger the remote script via a browser, giving it a greater chance of working.
Use a cron job on server B to check the directory every x minutes and move the file if it exists. This one should definitely work since you’re not doing anything remotely.