AnsweredAssumed Answered

Help on how to add a file upload dialog on my dashlet

Question asked by amarteis on Oct 24, 2012
Latest reply on May 11, 2015 by satheeshkumar
I need some help in making a link in my dashlet open up the Alfresco file upload dialog box to allow multi file selection.

Currently on clicking on the link, I get the error - "TypeError: YAHOO.util.Cookie is undefined"
when it tries to get an instance of the file upload dialog:
                this.fileUpload = Alfresco.getFileUploadInstance();

I have included the following in the header file for the dashlet :

<!– file upload dialog links –>
<@script type="text/javascript" src="${page.url.context}/res/components/upload/file-upload.js"></@script>
<@script type="text/javascript" src="${page.url.context}/res/components/upload/html-upload.js"></@script>
<@script type="text/javascript" src="${page.url.context}/res/components/upload/flash-upload.js"></@script>

Also the link in the dashlet calls the following method in the related javascript file

      onFileUpload: function PTL_onFileUpload(e, p_obj)
        {
           
       
            if (this.fileUpload === null)
            {
                this.fileUpload = Alfresco.getFileUploadInstance();
            }

            // Show uploader for multiple files
            var multiUploadConfig =
            {
                siteId: this.siteid,
                containerId: this.container,
                uploadDirectory: this.path,
                filter: [],
                mode: this.fileUpload.MODE_MULTI_UPLOAD,
                thumbnails: "doclib",
            };
            this.fileUpload.show(multiUploadConfig);
           
            if (YAHOO.lang.isArray(p_obj) && p_obj[1].tooltip)
            {
                var balloon = Alfresco.util.createBalloon(this.fileUpload.uploader.id + "-dialog",
                {
                    html: p_obj[1].tooltip,
                    width: "30em"
                });
                balloon.show();
           
                this.fileUpload.uploader.widgets.panel.hideEvent.subscribe(function()
                {
                    balloon.hide()
                });
            }
        },

Any help will be well appreciated.

Regards
Sam

Outcomes