kartik-v / bootstrap-fileinput

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.
http://plugins.krajee.com/file-input
Other
5.36k stars 2.4k forks source link

The problem was previously. Cannot read property 'push' when uploading invalid file #1759

Closed MaksTrader closed 3 years ago

MaksTrader commented 3 years ago

Prerequisites

Steps to reproduce the issue

1. 2. 3.

Expected behavior and actual behavior

When I follow those steps, I see...

I was expecting...

Environment

Browsers

Operating System

Libraries

Isolating the problem

MaksTrader commented 3 years ago

Greetings. Faced with the same problem. Checked and tried everything.

It only occurs when the first image is initially loaded.

Afterwards, until the page reloads, the problem does not appear. Images are added and deleted without problem Screenshot_1 .

MaksTrader commented 3 years ago

The model returns the same data for the first image as for the nex Screenshot_2 t.

MaksTrader commented 3 years ago

If you check the file download in this way, it happens in all cases, but the file is downloaded and after reloading the page is display Screenshot_4 ed

MaksTrader commented 3 years ago

But JSON returns empty values Screenshot_3 .

kartik-v commented 3 years ago

Debug your server code to check why initialPreview and initialPreviewConfig are sending null to the plugin.

If no files are available to send - send a blank json object (do not include initialPreview and initialPreviewConfig in the json response).

MaksTrader commented 3 years ago

Problem solved. The tips were very helpful. Thank you very much.

It wasn't labeled. $preview = []; $config = [];