Krajee

Bootstrap File Input Demo

Thankful to Krajee! BUY A COFFEEor to get more out of us.

Extension of scenario 1 for asynchronous uploads - in which you can dynamically setup the initialPreview and initialPreviewConfig immediately after upload at runtime. For this you must return the initialPreview, initialPreviewConfig, and append properties within a JSON object from your server. TIP: Try uploading each file through upload icon in the thumbnail and you can see each thumbnail getting replaced by the server generated file link. Refer to the documentation for receiving data on server or sending data from server in asynchronous mode.

Note

For these demo scenarios, the server code actually does not store / upload the files on the server and returns a dummy set of images for testing.

Code

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

<script>
$(document).ready(function() {
    $("#input-703").fileinput({
        uploadUrl: "/file-upload-single/2",
        minFileCount: 1,
        maxFileCount: 5,
        uploadExtraData: function(previewId, index) {
            return {key: index};
        },
        overwriteInitial: false,
        initialPreviewAsData: true // identify if you are sending preview data only and not the markup
    });
});
</script>

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Jquery Plugins since 22-May-2017