Saturday 30 August 2014

File Upload By JQuery

How to start uploads with a button click

 we can start uploads files on the click of a button 

$(function () {
    $('#fileupload').fileupload({
        dataType: 'json',
        add: function (e, data) {
            data.context = $('<button/>').text('Upload')
                .appendTo(document.body)
                .click(function () {
                    data.context = $('<p/>').text('Uploading...').replaceAll($(this));
                    data.submit();
                });
        },
        done: function (e, data) {
            data.context.text('Upload finished.');
        }
    });
});

0 comments::

Post a Comment

Copyright © DotNet-Ashok