function _flash_insert in Flash Node 5
Moves temporary file to flash directory and stores information in {files}
1 call to _flash_insert()
- flash_insert in ./
flash.module - Implementation of hook_insert
File
- ./
flash.module, line 612
Code
function _flash_insert($nid, $flash, $mime) {
// create the destination path and filename from the current name
$dest = _flash_filename(basename($flash));
// try to move the flash file to the flash folder, auto renames if it already exists
if (file_copy($flash, $dest)) {
// add file data to $node->file
$file->filename = '_flash';
$file->filepath = _flash_filename(basename($flash));
$file->filemime = $mime;
// note use of file_create_path, files are stored with only flash/ prepended so has to be qualified
$file->filesize = filesize(file_create_path($dest));
// create new record in files table
$fid = db_next_id('{files}_fid');
db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', '%s')", $fid, $nid, $file->filename, $file->filepath, $file->filemime, $file->filesize);
// return the assigned fid
return $fid;
}
}