1 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

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

Code

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