aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/storage/filestorage.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/storage/filestorage.py')
-rw-r--r--mediagoblin/storage/filestorage.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mediagoblin/storage/filestorage.py b/mediagoblin/storage/filestorage.py
index 22d6eb5a..a904865f 100644
--- a/mediagoblin/storage/filestorage.py
+++ b/mediagoblin/storage/filestorage.py
@@ -20,6 +20,7 @@ from mediagoblin.storage import (
NoWebServing)
import os
+import shutil
import urlparse
@@ -76,3 +77,16 @@ class BasicFileStorage(StorageInterface):
def get_local_path(self, filepath):
return self._resolve_filepath(filepath)
+
+ def copy_local_to_storage(self, filename, filepath):
+ """
+ Copy this file from locally to the storage system.
+ """
+ # Make directories if necessary
+ if len(filepath) > 1:
+ directory = self._resolve_filepath(filepath[:-1])
+ if not os.path.exists(directory):
+ os.makedirs(directory)
+
+ shutil.copy(
+ filename, self.get_local_path(filepath))