Как установить параметр autoUpload для загрузки файла JQuery

я пытаюсь установить флаг autoUpload на Загрузка файла jQuery. Итак, я пытаюсь отредактировать jquery.fileupload.jsследующим образом:

(function (factory) {
    'use strict';
    if (typeof define === 'function' && define.amd) {
        // Register as an anonymous AMD module:
        define([
            'jquery',
            'jquery.ui.widget'
        ], factory);
    } else {
        // Browser globals:
        factory(window.jQuery);
    }
}(function ($) {
    'use strict';

    // The FileReader API is not actually used, but works as feature detection,
    // as e.g. Safari supports XHR file uploads via the FormData API,
    // but not non-multipart XHR file uploads:
    $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
    $.support.xhrFormDataFileUpload = !!window.FormData;

    // The fileupload widget listens for change events on file input fields defined
    // via fileInput setting and paste or drop events of the given dropZone.
    // In addition to the default jQuery Widget methods, the fileupload widget
    // exposes the "add" and "send" methods, to add or directly send files using
    // the fileupload API.
    // By default, files added via file input selection, paste, drag & drop or
    // "add" method are uploaded immediately, but it is possible to override
    // the "add" callback option to queue file uploads.
    $.widget('blueimp.fileupload', {

        options: {
            // The namespace used for event handler binding on the dropZone and
            // fileInput collections.           
            // If not set, the name of the widget ("fileupload") is used.
            namespace: undefined,
            autoUpload:true,
            .
            .
            .

и main.jsследующим образом:

$(function () {
    'use strict';

    // Initialize the jQuery File Upload widget:
    $('#fileupload').fileupload();

    // Enable iframe cross-domain access via redirect option:
    $('#fileupload').fileupload(
        'option',
        'redirect',
        window.location.href.replace(
            /\/[^\/]*$/,
            '/cors/result.html?%s'
        )
    );

    if (window.location.hostname === 'blueimp.github.com') {
        // Demo settings:
        $('#fileupload').fileupload('option', {
            url: '//jquery-file-upload.appspot.com/',
            maxFileSize: 5000000,
            autoUpload:true,
            .
            .
            .

я вижу сквозь это

{% if (!o.options.autoUpload) { %}
    
{% } %}

эту кнопку запуска появляется, поэтому o.options.autoUpload имеет значение false, но я установил для него значение true. Что я могу сделать? каким образом я могу настроить автозагрузку для загрузки изображения напрямую, когда оно выбрано? Благодарность!!!!

6
задан JackTurky 17 May 2012 в 16:13
поделиться