diff options
Diffstat (limited to 'modules/watermark/controllers/watermark.php')
-rw-r--r-- | modules/watermark/controllers/watermark.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/modules/watermark/controllers/watermark.php b/modules/watermark/controllers/watermark.php index 4bf90401..a23cce64 100644 --- a/modules/watermark/controllers/watermark.php +++ b/modules/watermark/controllers/watermark.php @@ -22,13 +22,12 @@ class Watermark_Controller extends Controller { $form = watermark::get_watermark_form(); if ($form->validate()) { $file = $_POST["file"]; - - // Format of the file is config["upload.directory"]/uploadfile-hash-filename. - $index = strrpos($file, "-"); - $watermark_target = VARPATH . substr($file, strrpos($file, "-") + 1); - if (rename($file, $watermark_target)) { - module::set_var("watermark", "watermark_image_path", $watermark_target); + $pathinfo = pathinfo($file); + $watermark_target = $pathinfo["basename"]; + if (copy($file, VARPATH . $watermark_target)) { + module::set_var("watermark", "watermark_image_path", $watermark_target); + unlink($file); $form->success = _("Watermark saved"); } else { // @todo set and error message |