Foros de discusión

Multiple Upload using Liferay.Upload problem?

thumbnail
Rendi Januar, modificado hace 13 años.

Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 13 Fecha de incorporación: 6/12/10 Mensajes recientes
Hi guys,

Currently I'm using Liferay 6.04 CE , and now I want to create Portlet Plugin using MVC Portlet like Image Gallery Portlet that liferay have.
And I've got problem when try to implement multiple upload that liferay have. It work properly until i click the button upload file. When i click the button upload, it won't go to action that i wrote. FYI i already success when the process using classic uploader (single upload).
Is there anything wrong in my code so it won't go to my action?

new Liferay.Upload(
			{
				allowedFileTypes: '<%= StringUtil.merge(VirtualGalleryPrefsPropsUtil.getStringArray(PropsKeys.IG_IMAGE_EXTENSIONS, StringPool.COMMA)) %>',
				container: '#<portlet:namespace />fileUpload',
				fileDescription: '&lt;%= StringUtil.merge(VirtualGalleryPrefsPropsUtil.getStringArray(PropsKeys.IG_IMAGE_EXTENSIONS, StringPool.COMMA)) %&gt;',
				fallbackContainer: '#<portlet:namespace />fallback',
				maxFileSize: &lt;%= VirtualGalleryPrefsPropsUtil.getLong(PropsKeys.IG_IMAGE_MAX_SIZE) %&gt; / 1024,
				namespace: '<portlet:namespace />',
				uploadFile: '<liferay-portlet:actionurl windowstate="<%=LiferayWindowState.POP_UP.toString()%>" doasuserid="<%=user.getUserId()%>" name="editImage"><portlet:param name="<%=Constants.CMD%>" value="<%=Constants.ADD%>" /><portlet:param name="folderId" value="<%=String.valueOf(folderId)%>" /></liferay-portlet:actionurl><liferay-ui:input-permissions-params modelName="<%=VGImage.class.getName()%>" />'
			}
		);

Is there anybody that have the same problem and already settle it?

Regards,
Rendi
thumbnail
Anil Sunkari, modificado hace 13 años.

RE: Multiple Upload using Liferay.Upload problem?

Expert Mensajes: 427 Fecha de incorporación: 12/08/09 Mensajes recientes
Hi Rendi,

I have a suggestion for your request.Before that i want to know that where you have placed the portlet.Exactly i mean is it in PRIVATE or PUBLIC PAGES.
B'coz very recently i have faced the same problem of accessing a class.But finally i clarified that it is not calling if we keep it in Public Pages.Plz chk the same with you.Let me know if you got the solution/idea.

Thanks
Anil Sunkari
Victor Kozlov, modificado hace 13 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensaje: 1 Fecha de incorporación: 17/12/10 Mensajes recientes
Hi.
I've run into the same issue recently. You may already solved it but I'll try to describe what I found out anyway:
Liferay is using SwfUpload that does not support currently opened http session. That means it opens a new one when a file is uploaded. This is a main reason to all below.

1) We have to specify 'doAsUserId' in liferay-portlet:actionURL to make it interact on behalf of particular user. If you look at PortalImpl.getUserId you'll see code that makes Liferay 'believe' that user specified correctly:

		if (path.equals("/portal/session_click") ||
			strutsAction.equals("/document_library/edit_file_entry") ||
			strutsAction.equals("/image_gallery/edit_image") ||
			strutsAction.equals("/wiki/edit_page_attachment") ||
			actionName.equals("addFile")) {

			alwaysAllowDoAsUser = true;
		}

So you should use one of these actions to allow invocation chain to continue.

2) The next key point is auth token checks that LayoutAction.processPortletRequest performs. As long as new session is created for upload they generally fail. But you can change 'auth.token.ignore.actions' property to add more actions there that do not require token ckecks. SessionAuthToken reads this property and ignore relevant actions.

Then your action should go...

I also use MVCPortlet without struts but the simpliest workaround was adding
<portlet:param name="struts_action" value="/image_gallery/edit_image" />
to liferay-portlet:actionURL. My action started to work.
Here is the line:

uploadFile: '<liferay-portlet:actionurl windowstate="pop_up" name="editImage" doasuserid="<%= user.getUserId() %>"><portlet:param name="struts_action" value="/image_gallery/edit_image" /></liferay-portlet:actionurl>'
thumbnail
Rendi Januar, modificado hace 13 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 13 Fecha de incorporación: 6/12/10 Mensajes recientes
Hi Victor,
Thanks for the reply,actually i already settle the problem like in your explanation, but i don't know the reason why it can be done like that, now i already know it from you emoticon

Thanks,
Rendi
Yang bao, modificado hace 11 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 4 Fecha de incorporación: 15/03/12 Mensajes recientes
Can you send me the whole portlet code. I don't know how to mapping the MVCPortlet Action.
Vasu S, modificado hace 12 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensaje: 1 Fecha de incorporación: 6/08/11 Mensajes recientes
Hi Viktor,

I have a similar requirement & I tried out the same thing using MVCPortlet.
But I keep getting JSP error if I add <portlet:param name="struts_action" value="/image_gallery/edit_image" /> to my action URL tag.

This throws Jasper exception:
uploadFile: '<liferay-portlet:actionURL windowState="pop_up" name="editImage" doAsUserId="<%= user.getUserId() %>"><portlet:param name="struts_action" value="/image_gallery/edit_image" /></liferay-portlet:actionURL>'

This brings up the JSP, but action can't be associated:
uploadFile: '<liferay-portlet:actionURL windowState="pop_up" name="editImage" doAsUserId="<%= user.getUserId() %>"></liferay-portlet:actionURL>'

Any thoughts on this would be of great help, thx.

Thanks,
Vasu
resmi mathew, modificado hace 12 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 18 Fecha de incorporación: 2/02/11 Mensajes recientes
Thanks for explaining the solution here. I was facing problem with document library upload .I have used multi upload in my custom portlet and in my action class file name and folder Id values were coming null. By adding <portlet:param name="struts_action" value="/document_library/edit_file_entry" /> solved the issue.
Bakann DY, modificado hace 12 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 5 Fecha de incorporación: 16/10/09 Mensajes recientes
Victor Kozlov:

I also use MVCPortlet without struts but the simpliest workaround was adding
<portlet:param name="struts_action" value=" liferay-portlet:actionURL. My action started to work.
Here is the line:

uploadFile: '<liferay-portlet:actionurl windowstate="pop_up" name="editImage" doasuserid="<%= user.getUserId() %>"><portlet:param name="struts_action" value="/image_gallery/edit_image" /></liferay-portlet:actionurl>'


Yes it works!! emoticonBut how did you find that trick???
If I understand, you simulate a call to the struts_action "/image_gallery/edit_image".
Yang bao, modificado hace 11 años.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensajes: 4 Fecha de incorporación: 15/03/12 Mensajes recientes
Can you send me the whole upload portlet code. I don't know how to mapping the MVCPortlet Action.

view.jsp :
new Liferay.Upload({
allowedFileTypes: '.jpg',
container: '#testaui_holder',
maxFileSize: 1024,
namespace:'',
uploadFile: '<liferay-portlet:actionURL windowState="pop_up"
name="updateSlogan" doAsUserId="<%=user.getUserId()%>">
<portlet:param name="struts_action" value="/image_gallery/edit_image" />
</liferay-portlet:actionURL>',
buttonHeight: 100,
buttonText: 'BEGIN',
buttonWidth: 100,
});

I have the "updateSlogan" In my SloganMvc class which extends MVCPortlet class
thumbnail
sheela mk, modificado hace 11 años.

RE: Multiple Upload using Liferay.Upload problem?

Regular Member Mensajes: 111 Fecha de incorporación: 17/02/12 Mensajes recientes
Hai..All..If possible..Can You Please Let me know what the procedure..

for multiple File Upload..emoticon