JSON
The controller can call json return data format, data which is not required json
As a method of adding the controller:
public function actionRemoveImage($id){
Yii::$app->response->format = yii\web\Response::FORMAT_JSON;
Yii::$app->response->data = [
'status' => true
];
}
yii2 Download file
Yii2 method of using the sendfile
function actionDownload()
{
$imgFullPath = 'picture.jpg';
return Yii::$app->response->sendFile($imgFullPath);
}
References
yii2 file input If you need to remove the effect, to configure initialPreviewConfig
parameters