summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--local.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/local.go b/local.go
index 44aea76..85a4edc 100644
--- a/local.go
+++ b/local.go
@@ -238,17 +238,17 @@ func (a *LocalConn) Upload(bucket string, key string, path string) error {
if err != nil && !os.IsExist(err) {
return fmt.Errorf("Error creating temporary directory: %v", err)
}
- f, err := os.Create(filepath.Join(a.TempDir, bucket, key))
- if err != nil {
- return err
- }
- defer f.Close()
fin, err := os.Open(path)
if err != nil {
return err
}
defer fin.Close()
+ f, err := os.Create(filepath.Join(a.TempDir, bucket, key))
+ if err != nil {
+ return err
+ }
+ defer f.Close()
_, err = io.Copy(f, fin)
return err
}