diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index 2e7ad95712905ea8aa9d086e98310183a41d27d4..62b12fede09c875b93b82e27405b0c06d7fa60a1 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -92,7 +92,8 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
 			return false;
 		}
 		$head=fread($source,8192);//8kb should suffice to determine a mimetype
-		$tmpFile=tempnam(get_temp_dir(),'OC_TMP_').substr($path,strrpos($path,'.'));
+		$extention=substr($path,strrpos($path,'.'));
+		$tmpFile=OC_Helper::tmpFile($extention);
 		file_put_contents($tmpFile,$head);
 		$mime=OC_Helper::getMimeType($tmpFile);
 		unlink($tmpFile);
@@ -114,7 +115,8 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
 		if(!$source){
 			return false;
 		}
-		$tmpFile=tempnam(get_temp_dir(),'OC_TMP_').substr($path,strrpos($path,'.'));
+		$extention=substr($path,strrpos($path,'.'));
+		$tmpFile=OC_Helper::tmpFile($extention);
 		$target=fopen($tmpFile);
 		$count=OC_Helper::streamCopy($source,$target);
 		return $tmpFile;
diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index b014c3272f744d722d1d7e2a4e0948a0921e82c4..5996a5f60fbe2d405de45064c8000fc23895f279 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -278,8 +278,9 @@ class OC_FilesystemView {
 	public function toTmpFile($path){
 		if(OC_Filesystem::isValidPath($path)){
 			$source=$this->fopen($path,'r');
-			$tmpFile=tempnam(get_temp_dir(),'OC_TMP_').substr($path,strrpos($path,'.'));
 			if($source){
+				$extention=substr($path,strrpos($path,'.'));
+				$tmpFile=OC_Helper::tmpFile($extention);
 				return file_put_contents($tmpFile,$source);
 			}
 		}
diff --git a/lib/installer.php b/lib/installer.php
index 2cc7555f0d623777069635baa0000725e7b37549..2a9676998f6e537982fda061176aed2139d9c9ef 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -62,7 +62,7 @@ class OC_Installer{
 		
 		//download the file if necesary
 		if($data['source']=='http'){
-			$path=tempnam(get_temp_dir(),'oc_installer_');
+			$path=OC_Helper::tmpFile('.zip');
 			if(!isset($data['href'])){
 				OC_Log::write('core','No href specified when installing app from http',OC_Log::ERROR);
 				return false;
@@ -142,9 +142,6 @@ class OC_Installer{
 		
 		//remove temporary files
 		OC_Helper::rmdirr($extractDir);
-		if($data['source']=='http'){
-			unlink($path);
-		}
 		
 		//install the database
 		if(is_file($basedir.'/appinfo/database.xml')){