Edit record contain picture failed

I will edit article that containing picture of article, the record was success edit and saving., also the picture before is was success delete. But the new picture was failed to save.

code in my controller

public function edit($id = null)
    {
        $article = $this->Articles->get($id, [
            'contain' => ['Comments', 'Tags']
        ]);
		$article->user_id = $this->request->getSession()->read('Auth.User.ID');
		$article->Diubah = (Time::now())->i18nFormat('dd-MM-yyyy HH:mm:ss');
        if ($this->request->is(['patch', 'post', 'put'])) {
            $article = $this->Articles->patchEntity($article, $this->request->getData());
			$idgbrarticle = $this->Articles->findById($id)->firstOrFail();
			$hpsgbr = new File(WWW_ROOT . '/files/Articles/photo/' . $idgbrarticle->photo);
			$hpsgbr->delete();
			$article->photo = $this->request->getData();
            if ($this->Articles->save($article)) {
                $this->Flash->success(__('Artikel berhasil diperbarui.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('Artikel gagal diperbarui, Coba lagi.'));
        }
        $users = $this->Articles->Users->find('list', ['limit' => 200]);
        $comments = $this->Articles->Comments->find('list', ['limit' => 200]);
        $tags = $this->Articles->Tags->find('list', ['limit' => 200]);
        $this->set(compact('article', 'users', 'comments', 'tags'));
    }

I hope someone help me, thanx

please show the error message.

for what is this line of code?:

$article->photo = $this->request->getData();

if you are uploading images, you can get the properties of the uploaded images like this:

$image = $this->request->getData('image_file');

“image_file” is the name of the uploaded file, as it was defined in the upload form

I think you need to do

First check if previously image present delete that
Then save new image
Then patch entity and save

mean are the users must type the filename of picture, ooh noo.

there is not contain error, but in folder picture

/files/Articles/photo/ does not show new picture result editing record.

and in view.ctp just show blank of picture article. On current record ID, Judul, Isi, Comments, Tags was success edited

previous image success delete, but save new image failed,

show picture are blank in view ctp and in folder picture /files/Articles/photo/ does not show save new picture edited.

On record ID, Judul, Isi, Comments, Tags was success edited