Как отобразить имя файла в виде html-данных в шаблоне загрузки файла qq

Код шаблона загрузчика файлов Valums (загрузчик qq) выглядит следующим образом:

qq.FileUploader = function(o){
    // call parent constructor
    qq.FileUploaderBasic.apply(this, arguments);

    // additional options    
    qq.extend(this._options, {
        element: null,
        // if set, will be used instead of qq-upload-list in template
        listElement: null,
        dragText: 'Drop files here to upload',      
        uploadButtonText: 'Upload a file',        
        cancelButtonText: 'Cancel',        
        failUploadText: 'Upload failed',
        hideShowDropArea: true,

        template: '<div class="qq-uploader">' + 
                '<div class="qq-upload-drop-area"><span>{dragText}</span></div>' +
                '<div class="qq-upload-button">{uploadButtonText}</div>' +
                '<ul class="qq-upload-list"></ul>' + 
             '</div>',

        // template for one item in file list
        fileTemplate: '<li>' +
                '<span class="qq-progress-bar"></span>' +
                '<span class="qq-upload-file"></span>' +
                '<span class="qq-upload-spinner"></span>' +
                '<span class="qq-upload-size"></span>' +
                '<a class="qq-upload-cancel" href="#">{cancelButtonText}</a>' +
                '<span class="qq-upload-failed-text">{failUploadtext}</span>' +
            '</li>',        

        classes: {
            // used to get elements from templates
            button: 'qq-upload-button',
            drop: 'qq-upload-drop-area',
            dropActive: 'qq-upload-drop-area-active',
            dropDisabled: 'qq-upload-drop-area-disabled',
            list: 'qq-upload-list',
            progressBar: 'qq-progress-bar',
            file: 'qq-upload-file',
            spinner: 'qq-upload-spinner',
            size: 'qq-upload-size',
            cancel: 'qq-upload-cancel',

            // added to list item <li> when upload completes
            // used in css to hide progress spinner
            success: 'qq-upload-success',
            fail: 'qq-upload-fail'
        }
    });
    // overwrite options with user supplied    
    qq.extend(this._options, o);

    // overwrite the upload button text if any
    // same for the Cancel button and Fail message text
    this._options.template     = this._options.template.replace(/\{dragText\}/g, this._options.dragText);
    this._options.template     = this._options.template.replace(/\{uploadButtonText\}/g, this._options.uploadButtonText);
    this._options.fileTemplate = this._options.fileTemplate.replace(/\{cancelButtonText\}/g, this._options.cancelButtonText);
    this._options.fileTemplate = this._options.fileTemplate.replace(/\{failUploadtext\}/g, this._options.failUploadText);

    this._element = this._options.element;
    this._element.innerHTML = this._options.template;        
    this._listElement = this._options.listElement || this._find(this._element, 'list');

    this._classes = this._options.classes;

    this._button = this._createUploadButton(this._find(this._element, 'button'));        

    this._bindCancelEvent();
    this._setupDragDrop();
};

внутри <span class="qq-upload-file"></span> Я хочу добавить data-filename включая полное имя загруженного файла.

Это возможно?

Если да, как я могу это сделать?

(Мне нужны эти данные для последующего использования, и, видимо, это единственное решение моей проблемы, включая этот атрибут данных)

0 ответов

Другие вопросы по тегам