From f40cfd935d3d705dcbb9d70184ce4e4f68a13873 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 24 Apr 2008 13:55:12 +0000 Subject: [PATCH] "using the configured temp directory for uploaded files" --- etemplate/inc/class.link_widget.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.link_widget.inc.php b/etemplate/inc/class.link_widget.inc.php index cdadd95299..3262c16683 100644 --- a/etemplate/inc/class.link_widget.inc.php +++ b/etemplate/inc/class.link_widget.inc.php @@ -521,8 +521,16 @@ class link_widget { if (!$value['to_id'] || is_array($value['to_id'])) // otherwise the webserver deletes the file { - move_uploaded_file($value['file']['tmp_name'],$value['file']['tmp_name'].'+'); - $value['file']['tmp_name'] .= '+'; + if (is_dir($GLOBALS['egw_info']['server']['tmp_dir']) && is_writable($GLOBALS['egw_info']['server']['tmp_dir'])) + { + $new_file = tempnam($GLOBALS['egw_info']['server']['tmp_dir'],'egw_'); + } + else + { + $new_file = $value['file']['tmp_name'].'+'; + } + move_uploaded_file($value['file']['tmp_name'],$new_file); + $value['file']['tmp_name'] = $new_file; } $link_id = egw_link::link($value['to_app'],$value['to_id'], egw_link::VFS_APPNAME,$value['file'],$value['remark']);