Autoreplace does not work using fileinput bootstrap

Asked

Viewed 108 times

0

The idea is this:

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

Here is an example: http://plugins.krajee.com/file-input-ajax-demo/6

Follows 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>

On the line autoReplace: true is not working. When you select another image, you are not doing autoReplace.

On his website speaks the autoReplace example: http://plugins.krajee.com/file-auto-replace-demo

What am I doing wrong ?

  • A syntax error is the comma after the true, start by removing it.

  • I’ve already removed the comma

  • Follow the image, https://s27.postimg.org/j3q56mnlf/16_Jan_11_17_52.jpg

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.