cancel
Showing results for 
Search instead for 
Did you mean: 

KM folder multiple file download

Former Member
0 Kudos

Hello experts.

I need to download multiple files from a KM folder.

Is this possible wihout using WebDav?

I see that from the portal I can download one file at a time.

Is possible to download multiple files?

Thanks for your help.

Mario

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

of course it is possible with WebDav. This tool will allow you to work with KM object as you would do with your local hard disk drive.

Fabien.

Former Member
0 Kudos

Thanks.

You are right but the problem is this : WebDav doesn't work with Windows Vista, so to work with WebDav I would need to install Portal Drive.

But if the client is an external company user, I can't install portal drive on that PC, so it is better if that user logon to the portal and download multiple files from the portal, not using webdav.

So I need a solution to download multiple files using the portal instead of WebDav

Thanks

Former Member
0 Kudos

>

> Thanks.

>

> You are right but the problem is this : WebDav doesn't work with Windows Vista, so to work with WebDav I would need to install Portal Drive.

>

> But if the client is an external company user, I can't install portal drive on that PC, so it is better if that user logon to the portal and download multiple files from the portal, not using webdav.

>

> So I need a solution to download multiple files using the portal instead of WebDav

>

> Thanks

Portal is a Web server. WebDAV is a protocol.

That being said: you don't need WebDAV to download files. All you need is to do an HTTP GET request on its URI.

Tools you can use for that are download managers, wget, curl, and so on.

Former Member
0 Kudos

No, I don't like to use other tools.

I would like that an user login to the portal.

He goes on the KM folder where there are a lot of file.

So I would like that he is able to download more file on that KM folder.

Instead on an iView that link to a KM folder, you have the contextual menu on a single file:"Details"->"Actions"->"Download".

So I asked if is there possible to change KM menu to enable multiple download of files.

Thanks.

Mario

Former Member
0 Kudos

Hi,

with some development effort you could create a custom UI Command which will be available for the folder. When clicking on it it will gather all the resources, pack it into single ZIP and sends it to the client. That should be no problem to implement.

Hope that helps,

Romano

Former Member
0 Kudos

Hello,

could you give me some examples about the code if you have it ?

Thanks for your help.

Mario

Former Member
0 Kudos

Hi,

About creating a UI command search the forum. I think you should just get the desired directory and call an AbstractPortalComponent which will do the rest (getting the contents of the directory, zipping, ...). I don't have an exact example - I'll just provide you the basic howto for zipping the contents of a directory and sending it as outputstream to the client:


// first get the resources to ZIP and put them into IResourceList rList
// ...then prepare the ZIP...
ZipOutputStream zipOut = new ZipOutputStream(out);
zipOut.setMethod(ZipOutputStream.DEFLATED);

HttpServletResponse servletResponse = request.getServletResponse(true);
servletResponse.setContentType("application/zip");
servletResponse.setHeader("Content-Disposition", "attachment; filename=\"export.zip\"");
// for HTP 1.0
//servletResponse.setHeader("Pragma", "no-cache");
// for HTTP 1.1
servletResponse.setHeader("cache-control", "private");
servletResponse.setDateHeader("Expires", 0);
ServletOutputStream out = servletResponse.getOutputStream();

for (int i = 0, size = this.rList.size(); i < size; i++) {
    IResource res = this.rList.get(i);
    InputStream is = res.getContent().getInputStream();
    ZipEntry entry = new ZipEntry(res.getName());
    zipOut.putNextEntry(entry);
    byte[] buf = new byte[1024];
    long size = 0;
    int count = 0;
    while ((count = resultIs.read(buf)) >= 0) {
        zipOut.write(buf, 0, count);
        size += count;
    }
    zipOut.flush();
    zipOut.closeEntry();
}
zipOut.close();

For sure this is not the best method, but should work.

Hope that helps.

Romano

Answers (0)