public function replace() { $file = $this->file; $upload = new Upload($file->root(), array('overwrite' => true, 'accept' => function ($upload) use($file) { if ($upload->mime() != $file->mime()) { throw new Error(l('files.replace.error.type')); } })); $file = $this->move($upload); kirby()->trigger('panel.file.replace', $file); }
public function replace() { $file = $this->file; $upload = new Upload($file->root(), array('overwrite' => true, 'accept' => function ($upload) use($file) { if ($upload->mime() != $file->mime()) { throw new Error(l('files.replace.error.type')); } })); $file = $this->move($upload); // make sure that the file is being marked as updated touch($file->root()); // clean the thumbs folder $this->page->removeThumbs(); kirby()->trigger('panel.file.replace', $file); }