Foros de discusión

How to implement Multiple File Upload?

thumbnail
Raj K, modificado hace 13 años.

How to implement Multiple File Upload?

Regular Member Mensajes: 214 Fecha de incorporación: 19/06/09 Mensajes recientes
I want to use multiple file upload option in liferay in my portlet.

Can anyone tell me how do I achieve that using document library portlet's code?
Arun Kumar S, modificado hace 13 años.

RE: How to implement Multiple File Upload?

Regular Member Mensajes: 182 Fecha de incorporación: 23/06/08 Mensajes recientes
Raj K:
I want to use multiple file upload option in liferay in my portlet.

Can anyone tell me how do I achieve that using document library portlet's code?



Refer the below api to use multiple file upload

com.liferay.portlet.journal.action.EditArticleAction.java


	
protected Map<string, byte[]> getImages(UploadPortletRequest uploadRequest)
		throws Exception {

		Map<string, byte[]> images = new HashMap<string, byte[]>();

		String imagePrefix = "structure_image_";

		Enumeration<string> enu = uploadRequest.getParameterNames();

		while (enu.hasMoreElements()) {
			String name = enu.nextElement();

			if (name.startsWith(imagePrefix)) {
				File file = uploadRequest.getFile(name);
				byte[] bytes = FileUtil.getBytes(file);

				if ((bytes != null) &amp;&amp; (bytes.length &gt; 0)) {
					name = name.substring(imagePrefix.length(), name.length());

					images.put(name, bytes);
				}
			}
		}

		return images;
</string></string,></string,></string,>


HTH,
Arun