Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to delete newly downloaded files? #1864

Closed
muramidaza opened this issue Jun 11, 2024 · 0 comments
Closed

How to delete newly downloaded files? #1864

muramidaza opened this issue Jun 11, 2024 · 0 comments

Comments

@muramidaza
Copy link

I used FileInput with the ability to download via Ajax. The file is added and uploaded to the server. When I click the Delete button, the file is also deleted from the panel, but no request is sent to the server. When the page is loaded, the initial (already downloaded files) are added - from there they are deleted normally by Ajax. How to make sure that when a file is deleted, a deletion request is sent to the server.

$fileForm = $form->field($requestFilesForm, 'uploadFiles[]')->widget(FileInput::class, [ 'language' => 'ru', 'options' => [ 'multiple' => true, 'accept' => '', ], 'pluginOptions' => [ 'previewFileType' => 'image', 'deleteUrl' => Url::to(['delete-file'],true), 'uploadUrl' => $model->id ? Url::to(['upload-files', 'id' => $model->id]) : null, 'uploadExtraData' => [ 'id' => $model->id, ], 'overwriteInitial' => false, 'showPreview' => true, 'initialPreview' => $files, 'initialPreviewFileType' => 'image', 'initialPreviewAsData' =>true, 'initialPreviewConfig' => $initialPreviewConfig, 'pluginEvents' => [ "fileuploaded" => "function(event, data, previewId, index) { console.log(data) }", ], 'maxFileSize' => 50000 ], ])->label('Прикрепленные файлы');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant