-1

I'm using a jquery plugin located here file-upload

I can get the example located in the plugin folder to work. However when I try to integrate the plugin into my website I keep getting the following error in the console:

 attempt to run compile-and-go script on a cleared scope     jquery.min.js(line2)
 Failed to load source for: http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js

In the script tab of the console it's got a break notification with:

JSON.parse

I've not come across this error before so I'm not too sure where to start...

edit

Thanks for replies so far, okay I've got it work without errors appearing in the console now. In application.js I used this instead:

$(function () {
    $('#fileupload').fileupload({
        dataType: 'json',
        url: 'upload.php',
        done: function (e, data) {
            $.each(data.result, function (index, file) {
                $('<p/>').text(file.name).appendTo('body');
            });
        }
   });
}); 

I haven't moved the files outside of their plugin folder.

I can see that the files have been uploaded to the folder. When I click to start the upload process for a split second I see two progress bars, the one along the bottom will disappear on completion. However there is another progress bar next to the thumbnail which doesn't disappear and stays stuck at 90%, the cancel button will also remain and become unresponsive. I don't see the trash can either.

Given that the files uploaded okay, do you think this could be a CSS issue?

The stuck progress bar class:

 ui-progressbar ui-widget ui-widget-content ui-corner-all
lemon
  • 595
  • 1
  • 7
  • 21
  • I am working with the same but with Asp.Net and working fine and make sure that you have the plugins jquery.fileupload.js and jquery.iframe-transport.js and application.js in your folder along with Jquery latest version if still the problem exists paste your code so that I can help you. – coder Oct 24 '11 at 15:55
  • Note sure if that helps, but: possible duplicate of [Error: Attempt to run compile-and-go script on a cleared scope](http://stackoverflow.com/questions/5433415/error-attempt-to-run-compile-and-go-script-on-a-cleared-scope) - You might want to google for that error message a bit further, there are various references. – mario Oct 24 '11 at 15:55
  • Thanks, edited above with more info – lemon Oct 24 '11 at 16:17

1 Answers1

1

Try this:

 <script>
            /*global $ */
            $(function () {
                $('#file_upload').fileUploadUI({
                    url: 'FileUpload.ashx',
                    method: 'POST',
                    uploadTable: $('#files'),
                    downloadTable: $('#files'),
                    buildUploadRow: function (files, index) {
                        return $('<tr><td>' + files[index].name + '<\/td>' +
                            '<td class="file_upload_progress"><div><\/div><\/td>' +
                            '<td class="file_upload_cancel">' +
                            '<button class="ui-state-default ui-corner-all" title="Cancel">' +
                            '<span class="ui-icon ui-icon-cancel">Cancel<\/span>' +
                            '<\/button><\/td><\/tr>');
                    },
                    buildDownloadRow: function (file) {
                        return $('<tr><td>' + file.name + '<\/td><\/tr>');
                    }
                });
            });
        </script> 
coder
  • 13,002
  • 31
  • 112
  • 214