several fixes for attachments

This commit is contained in:
Friendika 2011-08-03 19:18:58 -07:00
parent d0b7723bbc
commit ad1e827169
6 changed files with 24 additions and 14 deletions

View file

@ -60,11 +60,11 @@ function wall_attach_post(&$a) {
}
$filedata = @file_get_contents($src);
$mimetype = mime_content_type($src);
$mimetype = z_mime_content_type($filename);
if((! strlen($mimetype)) || ($mimetype === 'application/octet-stream') && function_exists('mime_content_type'))
$mimetype = mime_content_type($filename);
$hash = random_string();
$created = datetime_convert();
$r = q("INSERT INTO `attach` ( `uid`, `hash`, `filename`, `filetype`, `filesize`, `data`, `created`, `edited`, `allow_cid`, `allow_gid`,`deny_cid`, `deny_gid` )
VALUES ( %d, '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ",
intval($page_owner_uid),