Fórum

Using SWFUpload in SpringMVC Portlet

thumbnail
Christian Schulze, modificado 11 Anos atrás.

Using SWFUpload in SpringMVC Portlet

Junior Member Postagens: 87 Data de Entrada: 19/11/09 Postagens Recentes
Hello, I want to use the Flash Tool SWFUpload to implement multiple Selection of Files for Upload.
I see Liferay use for DocumentLibrary the same Flash Tool. I use uploadify which uses the same.

When i use it i see that Flash make the post to the Ajax Resource, but don't get the necessary params form the liferay session. Which params from the Session is necessary to make the Post in Flash?

regards
Chris
thumbnail
Amos Fong, modificado 11 Anos atrás.

RE: Using SWFUpload in SpringMVC Portlet

Liferay Legend Postagens: 2047 Data de Entrada: 07/10/08 Postagens Recentes
Hi,

There's a few things you need to do to get this to work because there's a bug in flash where the session is not passed in.

Take a look at upload_multiple_file_entries.jsp in DL to see how to code it.

1. First you need a Ticket so you can impersonate the user
2. Add an actionname "addFile" to tell the portal it needs to impersonate the user (ie <portlet:param name="actionName" value="addFile" />)
3. Because you don't have the original session the auth token check isn't going to work. So 2 options here:
3a. in portlet.xml add this param so no actions in your portlet are checked.
		<init-param>
			<name>check-auth-token</name>
			<value>false</value>
		</init-param>


3b. The other method is to implement your own authtoken check that will allow for that specific action:

		AuthTokenUtil authTokenUtil =
			(AuthTokenUtil)PortalBeanLocatorUtil.locate(
				AuthTokenUtil.class.getName());

		AuthToken originalAuthToken = AuthTokenUtil.getAuthToken();

		AuthToken myAuthToken = new MyAuthToken(originalAuthToken);

		authTokenUtil.setAuthToken(myAuthToken);