Fórum

Multiple Upload using Liferay.Upload problem?

thumbnail
Rendi Januar, modificado 13 Anos atrás.

Multiple Upload using Liferay.Upload problem?

New Member Postagens: 13 Data de Entrada: 06/12/10 Postagens Recentes
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 13 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

Expert Postagens: 427 Data de Entrada: 12/08/09 Postagens Recentes
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 13 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensagem: 1 Data de Entrada: 17/12/10 Postagens Recentes
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 13 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Postagens: 13 Data de Entrada: 06/12/10 Postagens Recentes
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 11 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Postagens: 4 Data de Entrada: 15/03/12 Postagens Recentes
Can you send me the whole portlet code. I don't know how to mapping the MVCPortlet Action.
Vasu S, modificado 12 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Mensagem: 1 Data de Entrada: 06/08/11 Postagens Recentes
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 12 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Postagens: 18 Data de Entrada: 02/02/11 Postagens Recentes
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 12 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Postagens: 5 Data de Entrada: 16/10/09 Postagens Recentes
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 11 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

New Member Postagens: 4 Data de Entrada: 15/03/12 Postagens Recentes
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 11 Anos atrás.

RE: Multiple Upload using Liferay.Upload problem?

Regular Member Postagens: 111 Data de Entrada: 17/02/12 Postagens Recentes
Hai..All..If possible..Can You Please Let me know what the procedure..

for multiple File Upload..emoticon