##Using Kirby 2.1 I was not able to replace an existing image-file.
Even when both files had the same extension (and filename) I got this error;
In Kirby 2.2 the same error exist;
- Upload a new image - no problem
- Try to replace that image with another image (with the same extension) - error message
- Try to replace that image with exact the same image (just to be sure) - error
In both Kirby 2.1 and 2.2 I managed to “solve” this bug, by making the replace-function the same as the upload-function (which of course is nasty to do).
See the code below for Kirby 2.2 - (file /panel/app/controlers/files.php
)
public function replace($id, $filename) {
$page = $this->page($id);
$file = $this->file($page, $filename);
try {
// $file->replace();
$page->upload();
$this->notify(':)');
} catch(Exception $e) {
$this->alert($e->getMessage());
}
$this->redirect($file);
}
I disabled the replace()
call and set a new upload()
call instead.
Now I can replace images on my server(s), but they must have the same new as the old one - because it’s an upload function, not a replace function…
Tested on XAMPP (newest version) and two (shared) servers.
On a dedicated server, everything works out of the box, but I do not always have clients, using dedicated ones…