Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-02-28 14:33:59 +0400
committerRobin Appelman <icewind@owncloud.com>2012-02-28 14:33:59 +0400
commit3e0bb3e7c4a34b3e7344665b901918ce54b57d81 (patch)
tree53176a0c4efe97aa9fdb464199ffe1a9da1654cd /lib/filestorage
parenta76ff563d645ce456d6366b34fd763d5b11ee0d3 (diff)
use temporary file managment
Diffstat (limited to 'lib/filestorage')
-rw-r--r--lib/filestorage/common.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index 2e7ad957129..62b12fede09 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;