| 5 blogapi.module | blogapi_metaweblog_new_media_object($blogid, $username, $password, $file) |
| 6 blogapi.module | blogapi_metaweblog_new_media_object($blogid, $username, $password, $file) |
Blogging API callback. Inserts a file into Drupal.
1 string reference to 'blogapi_metaweblog_new_media_object'
File
- modules/
blogapi.module, line 343 - Enable users to post using applications that support XML-RPC blog APIs.
Code
function blogapi_metaweblog_new_media_object($blogid, $username, $password, $file) {
$user = blogapi_validate_user($username, $password);
if (!$user->uid) {
return blogapi_error($user);
}
$name = basename($file['name']);
$data = $file['bits'];
if (!$data) {
return blogapi_error(t('No file sent.'));
}
if (!$file = file_save_data($data, $name)) {
return blogapi_error(t('Error storing file.'));
}
// Return the successful result.
return array('url' => file_create_url($file), 'struct');
}
Login or register to post comments