$(...).fileupload is not a function - JS dep. missing?

3,071 views
Skip to first unread message

spark

unread,
Dec 3, 2014, 9:53:49 AM12/3/14
to sonata...@googlegroups.com
This has been posted on github as well, since I'm not sure if I misconfigured something or if it's a bug.

I am following the fileupload recipe to upload a file. The upload button looks weird and the console tells me:

TypeError: $(...).fileupload is not a function


$('#fileupload').fileupload({
^

I tried it with and without SonatajQueryBundle enabled in my AppKernel. I am using doctrine-orm-admin-bundle: "2.3.0". Did I miss to configure something? What is the particular js file called that contains this function (would probably be most helpful to find a workaround)?

This is the code snippet where this is happening:

<script type="text/javascript">
        $(function () {
            'use strict';
            // Change this to the location of your server-side upload handler:
            var url = '/web/app_dev.php/_uploader/files/upload';
            $('#fileupload').fileupload({
                url: url,
                dataType: 'json',
                done: function (e, data) {
                    $('<p/>').text(data.result.file).appendTo('#files');
                    $('#uploadedFile').val(data.result.fileId);
                    $('#fileUploadButtonContainer').remove();
                },
                progressall: function (e, data) {
                    var progress = parseInt(data.loaded / data.total * 100, 10);
                    $('#progress .uk-progress-bar').css(
                            'width',
                            progress + '%'
                    );
                    $('#progress .uk-progress-bar').text(progress + '%');
                }
            }).prop('disabled', !$.support.fileInput)
                    .parent().addClass($.support.fileInput ? undefined : 'disabled');
        });
    </script>

Cassiano Tartari

unread,
Dec 3, 2014, 10:32:57 AM12/3/14
to sonata-users
Didn't read the recipe but this function is the same as Jquery File Upload plugin that I'm using in a project.

​Maybe adding the js of this plugin solve the issue.​


--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonata-users...@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at http://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.

spark

unread,
Dec 3, 2014, 2:58:50 PM12/3/14
to sonata...@googlegroups.com
Yep.. sorry, my bad. Turned out I was overriding the form field previously
Reply all
Reply to author
Forward
0 new messages