function _photos_save_data in Album Photos 6.2
Same name and namespace in other branches
- 7.3 photos.module \_photos_save_data()
2 calls to _photos_save_data()
- photos_swfu_upload in photos_swfu/
photos_swfu.module - _photos_unzip in ./
photos.module
File
- ./
photos.module, line 1384
Code
function _photos_save_data($file, $val = array()) {
$errors = array();
foreach ($val as $function => $args) {
array_unshift($args, $file);
$errors = array_merge($errors, call_user_func_array($function, $args));
}
if (!empty($errors)) {
$message = t('The selected file %name could not be uploaded.', array(
'%name' => $file->filename,
));
if (count($errors) > 1) {
$message .= '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>';
}
else {
$message .= ' ' . array_pop($errors);
}
drupal_set_message($message);
return 0;
}
db_query("INSERT INTO {files} (fid, uid, filename, filepath, filesize, filemime, status, timestamp) VALUES (NULL, %d, '%s', '%s', %d, '%s', 1, %d)", $file->uid, $file->filename, $file->filepath, $file->filesize, $file->filemime, time());
return db_last_insert_id('files', 'fid');
}