cancel
Showing results for 
Search instead for 
Did you mean: 

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

amarteis
Champ in-the-making
Champ in-the-making
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
4 REPLIES 4

afaust
Legendary Innovator
Legendary Innovator
Hello,

in order to use any file upload, you need to include the upload components of choice in your page template markup, as otherwise there will be no initialisation of any upload component that can be used at runtime. Take a look at the documentlibrary.ftl and documentlibrary.xml template files for how to include the components. You may have to provide a special dashboard template for this (or modify the default ones).

Regards
Axel

amarteis
Champ in-the-making
Champ in-the-making
Hi Axel,

You were spot on, I had not included the components upload in the page template, I did this and this worked as I expected.

Thanks very much for your help.

Regards
Sam

Hi Amerties,

Can you please post your codes here, so we can understand how to use Upload feature on custom pages.

Thanks in Advance,
Satheesh D

_jan
Champ on-the-rise
Champ on-the-rise
Hi, can you give me example of how you load the upload components. I include important files like
dnd-upload.js
and
file-upload.js
but it still not working. And I get this javascript error
No instance of uploader type 'Alfresco.DNDUpload' exists.


THanks