Sent uploaded file to third-party API instead of saving it locally

This is what I have now:

  1. User upload a file through a form.
  2. Gravity Forms save the file in wp-content/uploads/gravity_forms.
  3. gform_after_submission to access the uploaded file and then sent it to a third-party API.
  4. I use the unlink() to delete the file from wp-content/uploads/gravity_forms.

Is there a way to avoid saving the file in wp-content/uploads/gravity_forms and e.g. use $_FILES variable to retrieve the file and then sent it to the API?

There’s no way to bypass the wp-content/uploads/gravity_forms/ folder, if that’s what you mean. It has to land there first and then you can unlink() it.