summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/service/files.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/application/service/files.php b/application/service/files.php
index e31efacc1..a2aa83c3b 100644
--- a/application/service/files.php
+++ b/application/service/files.php
@@ -78,9 +78,11 @@ class files {
file_exists($dir) || mkdir ($dir);
$new_path = $CI->mfile->file($hash);
- // TODO: make this operation atomic (move to temp name, then to final)
- // the source can be a different file system so this might do a copy
- move_uploaded_file($file, $new_path);
+ $dest = new \service\storage($new_path);
+ $tmpfile = $dest->begin();
+ move_uploaded_file($file, $tmpfile);
+ $dest->commit();
+
$CI->mfile->add_file($hash, $id, $filename);
}