I need my users to be able to upload some files from the backend, with the functionality of a preview image, abort button, multiple files uploadable, etc.

And since Magento already uses the blueimp/jQuery-File-Upload Plugin for the backend, I think it would be the best to use it for my frontend as well.

But when I try to add files I always get this error:

TypeError: that is undefined

Triggered by the following code in magento/lib/web/jquery/fileUploader/jquery.fileupload-ui.js:

var that = $(this).data('fileupload'),

Here is my implementation:

uploader.phtml (template file)

<form id="fileupload" action="//jquery-file-upload.appspot.com/" method="POST" enctype="multipart/form-data">

    <div class="row fileupload-buttonbar">
            <span class="btn btn-success fileinput-button">
                <i class="glyphicon glyphicon-plus"></i>
                <span>Add files...</span>
                <input type="file" name="files[]" multiple>
            <button type="submit" class="btn btn-primary start">
                <span>Start upload</span>
            <button type="reset" class="btn btn-warning cancel">
                <span>Cancel upload</span>
            <button type="button" class="btn btn-danger delete">
            <input type="checkbox" class="toggle">
            <span class="fileupload-process"></span>

    <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>


<script type="text/x-magento-init">
    "#fileupload": {

fileuploader.js (defined in requirejs-config.js)

], function($, _) {
    "use strict";

    return function() {

            url: '/upload/ajaxupload/'


Where am I wrong? I gotta admit, I never did that much with jquery widgets.

1 Answer 1

 var that = $(this).data('fileupload'),

Element dos't have attribute




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.