Home > front end >  The bootstrap the fileinput set minFileCount=1, when uploading has been prompt "you must select
The bootstrap the fileinput set minFileCount=1, when uploading has been prompt "you must select

Time:10-01

The bootstrap the fileinput set minFileCount=1, when uploading has been prompt "you must select at least two files to upload", please help to see

CodePudding user response:

The original poster to solve this problem, I also met

CodePudding user response:

When click upload error, you must select at least X a file upload,
The reason for the error: input tags in HTML element properties: data - min - file - count="2" is set to X files, limit to upload files

CodePudding user response:

maxFileCount

CodePudding user response:

MaxFileCount: 0
Can solve this problem, but the fileinput maximum minimum limit,

CodePudding user response:

There is a temporary solution to solve this problem, first empty container images, maximum minimum limit at the moment, as follows:
//click browse box the top right corner X or the total response to an event after the delete button to empty file
$(" # file ") on (' filecleared ', function (event, file) {
$(event. The target). The fileinput (" refresh ", {maxFileCount minFileCount: 0:0}).
.
}
//new upload files deleted successfully executed when
$(" # file ") on (" filesuccessremove ", function (event, uploadedId, index) {
$(event. The target). The fileinput (" refresh ", {minFileCount: 0, maxFileCount: 5});
.
}
//load the preview picture to delete, processing after (delete)
$(" # file ") on (' filedeleted ', function (event, key) {
$(event. The target). The fileinput (" refresh ", {minFileCount: 0, maxFileCount: 5});
.
}

CodePudding user response:

Final solution, a single line of code, as follows: (points must be praised, for an afternoon,,,)
/* * * edit, loaded the preview picture to delete, processing after (delete) * * */
$(" # file ") on (' filedeleted ', function (event, key) {
//address to upload new tip maximum upload limit of news, and then you delete after the preview, in time to upload new graphic can't show the same problem (the top right-hand corner point [X]) when also can't solve,
$(event. The target). The fileinput (' clear '). The fileinput (' unlock ');//key code
//hide "delete" button (optional)
//$(event. The target). The parent (). The siblings ('. The fileinput - remove '). Hide ();
.
}
  • Related