0

I'm using "Bootstrap File Input" -

http://plugins.krajee.com/file-input

each time I browser and choose file the old file that i already chose auto removed from the preview section. how can i fix that?

$(document).on('ready', function() {
    $("#input-8").fileinput({
        rtl: true,
        language: "he",
        allowedFileExtensions: [<?PHP echo VALID_IMG_FILES2 ?>],
        maxFileCount: <?PHP echo MAX_UPLOAD_FILES ?>,
        maxFilePreviewSize: 5120, // 5 MB
        maxImageWidth: 150,
        maxImageHeight: 100,
        resizePreference: 'height',
        resizeImage: true,
        theme: "explorer",
        validateInitialCount: true,
    //  uploadUrl: "/file-upload-batch/2",
        showRemove: false,
        showUpload: false,
        required: true,
        overwriteInitial: false,
        initialPreviewAsData: true,
        layoutTemplates: {
            main1: "{preview}\n" +
            "<div class=\'input-group {class}\'>\n" +
            "   <div class=\'input-group-btn\'>\n" +
            "       {browse}\n" +
            "       {upload}\n" +
            "       {remove}\n" +
            "   </div>\n" +
            "   {caption}\n" +
            "</div>"
        }       
    });
});
Roi
  • 49
  • 8
  • 1
    I'm not 100% sure what you're asking, but it sounds like you expect to be able to select multiple files at a time. In which case, add the `multiple` attribute to the file input. If that's not what you're asking, please edit the question to give a clear problem statement – Rory McCrossan Jun 07 '17 at 09:24
  • Are you sure the PHP variable at maxfilecount give you correct value? If its only 1 existing files get replaced when new files added – Sandeep Thomas Jun 07 '17 at 09:41
  • @RoryMcCrossan - hi. I chose an image, show it in the preview area, and than i browser again and chose another image. the first one disappear from the preview area – Roi Jun 07 '17 at 14:27
  • @sforsandeep - yes , the value is "10" – Roi Jun 07 '17 at 14:27
  • @Roi that's because a file input can only hold one file at a time. If you select from it again, you're replacing the originally selected file. To choose multiple files, add the `multiple` attribute on the element as I mentioned earlier – Rory McCrossan Jun 07 '17 at 14:33
  • @RoryMcCrossan - thanks – Roi Jun 07 '17 at 15:56

0 Answers0