[...document.querySelectorAll('.eq')]
если без етого оператора тоже работает? foreach ($this->getAll($id)->getModels() as $k => $file) {
if (file_exists($filename)) {
$return_json[] = [
'caption' => $file->file_name,//$_SERVER['DOCUMENT_ROOT'] . '/web/uploads/docs/'.$id.'/' . $file->file_name,
'size' => filesize($filename . '/' . $file->file_name),
'url' => $urlDel,
'key' => $file->id,
];
return $return_json;
} else {
}
}
<?= Yii::$app->controller->renderPartial('manager/create_form/_files2', ['form' => $form, 'model' => $model, 'files' => $files]); ?>
if (! $model->isNewRecord) {
echo $form->field($files, 'files')->widget(FileInput::classname(), [
'options'=>[
'multiple'=>true,
],
'pluginOptions' => [
'showCaption' => true,
'showUpload' => false,
'uploadUrl' => Url::to(['/ajax/clientuploadfile/', 'id' => $model->id]),
'uploadExtraData' => [
'user_id' => $model->id,
],
'initialPreview' => $files->initialPreview($model->id),
'initialPreviewConfig' => $files->initialPreviewConfig($model->id, Url::to(['/ajax/clientdeletefile/', 'user_id' => $model->id])),
'overwriteInitial'=>false,
'maxFileCount' => 20,
'fileActionSettings' => [
'showZoom' => true,
'showDrag' => false,
],
],
]);
}
if (! $model->isNewRecord) {
echo $form->field($files, 'files')->widget(FileInput::classname(), [
'options'=>[
'multiple'=>true,
],
'pluginOptions' => [
'showCaption' => true,
'showUpload' => false,
'uploadUrl' => Url::to(['/ajax/clientuploadfile/', 'id' => $model->id]),
'uploadExtraData' => [
'user_id' => $model->id,
],
'initialPreview' => $files->initialPreview($model->id),
'initialPreviewConfig' => $files->initialPreviewConfig($model->id, Url::to(['/ajax/clientdeletefile/', 'user_id' => $model->id])),
'overwriteInitial'=>false,
'maxFileCount' => 20,
'fileActionSettings' => [
'showZoom' => true,
'showDrag' => false,
],
],
]);
}
{
$filename = 'web/uploads/docs/' . $id;
if (file_exists($filename)) {
$return_json = [];
foreach ($this->getAll($id)->getModels() as $k => $file) {
$return_json[] = [
'caption' => $file->file_name,//$_SERVER['DOCUMENT_ROOT'] . '/web/uploads/docs/'.$id.'/' . $file->file_name,
'size' => filesize($filename . '/' . $file->file_name),
'url' => $urlDel,
'key' => $file->id,
];
}
return $return_json;
}
}
public function initialPreviewConfig($id, $urlDel)
{
$filename = 'web/uploads/docs/' . $id;
$return_json = [];
foreach ($this->getAll($id)->getModels() as $k => $file) {
$return_json[] = [
'caption' => $file->file_name,//$_SERVER['DOCUMENT_ROOT'] . '/web/uploads/docs/'.$id.'/' . $file->file_name,
'size' => filesize($filename . '/' . $file->file_name), // Здесь ошыбку выдает
'url' => $urlDel,
'key' => $file->id,
];
}
return $return_json;
}