file unmanaged save upload I'm moving some existing functionality into a new Drupal site.


Files are uploaded via posted form
Their file names are prefixes with UID
They are then moved to temp holding directory
A cron job on another server SCPs the files in batches
The files are verified copied, then deleted via batch ssh command


I'm looking for a clean way to handle (save) an uploaded file coming from a submitted form with an element of type 'file' without "managing" it. I've browsed over file_save_upload() and like the validation/error handling it offers.

However, I'd rather not have the files exist in the managed file tables. I would need to modify my pulling server's cron job to trigger a managed deletes via web request.

Just as there is a file_save_data() and analogous file_unmanaged_save_data() I'm looking for file_unmanaged_save_upload(). I basically want the first half of file_save_upload() before it touch the database. It seems like something similar or a workaround should already exist but I haven't found one. I trying to avoid reinventing the wheel.
I suggest using file_save_upload() anyway, beacause (as the API docs say):


  The file will be added to the {file_managed} table as a temporary file. Temporary files are periodically cleaned. To make the file a permanent file, assign the status and use file_save() to save the changes.


So you don't need to worry about having the file "managed" by Drupal as long as you don't change the status of the file to FILE_STATUS_PERMANENT.

Otherwise, if you really don't want this default behaviour (and also no hooks to get invoked), just copy the file in your form_submit() using file_unmanaged_copy() (give it uploaded tmp file as source).