1.20.x file.inc file_save(File $file)

Saves a new or updated file.

Parameters

File $file: A file object returned by file_load(). If the $file->fid is not set a new record will be added.

Return value

int: Either SAVED_NEW or SAVED_UPDATED depending on the operation performed.

See also

hook_file_insert()

hook_file_update()

Related topics

File

includes/file.inc, line 631
API for handling file uploads and server file management.

Code

function file_save(File $file) {
  return $file->save();
}