AutoReplace does not work using bootstrap fileinput

0

The idea is as follows:

When selecting image, it will directly save to the database without using save button.

Here's an example: link

Follow the code:

Html :

<input id="input-705" name="kartik-input-705[]" type="file" multiple class="file-loading">

Script :

<script>
var $input = $("#input-705");
$input.fileinput({
    uploadUrl: "@Url.Action("Upload", "Controller", new { id = Model.Id})", // server upload action
    uploadAsync: false,
    showUpload: false, // hide upload button
    showRemove: false, // hide remove button
    minFileCount: 1,
    maxFileCount: 1,
    autoReplace: true
}).on("filebatchselected", function(event, files) {
    // trigger upload method immediately after files are selected
    $input.fileinput("upload");
});
</script>

The autoReplace: true line is not working. When selecting another image, you are not doing autoReplace.

On his site he speaks the example of autoReplace: link

What am I doing wrong?

    
asked by anonymous 11.01.2017 / 20:48

0 answers