You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Dimitar Dimitrov <dd...@consult.bg> on 2012/08/29 12:20:05 UTC

Adobe Flex FileReference.upload() to Sling

Hello everyone.
I am trying to implement the file upload functionality to Sling from 
Adobe Flex based client.
I tried all of the possibilities in the Flex FileReference.upload() 
method but unsuccessfully. Then I saw that Flex client sends properties 
of the request differently than the standard HTTP form.
The main issue is that I am trying to upload the file into the nt:folder 
element and Slings returns the IOError event. After some investigations 
I found that the Sling tries to create a property with name 
"{}Filename", which is actually sent from the Adobe flash player. If I 
try to upload a file into the nt:unstructured node everything is OK, but 
the file did not stands as a nt:file. There is an another issue that can 
produce IOError event. The Flash player in Firefox did not send the 
authentication parameters from the cookie. There are some workarounds 
that can fix this issue, so my problem is not in the authentication.
After that I decide to make a PUT call to the Sling, but it turned out 
that the browser's flash player did not support PUT HTTP Request. So the 
next step that I decide to do is to produce my own PostOperationServlet 
which can do the actual nt:file creation from custom HTTP POST request. 
I am almost done but just in case I decide to ask you about the other 
possibility which can do the browser based Adobe Flex upload to Sling.

Thanks in advance.
Dimitar

Re: Adobe Flex FileReference.upload() to Sling

Posted by Vidar Ramdal <vi...@webstep.no>.
2012/8/29 Dimitar Dimitrov <dd...@consult.bg>:
> Hello everyone.
> I am trying to implement the file upload functionality to Sling from Adobe
> Flex based client.
> I tried all of the possibilities in the Flex FileReference.upload() method
> but unsuccessfully. Then I saw that Flex client sends properties of the
> request differently than the standard HTTP form.
> The main issue is that I am trying to upload the file into the nt:folder
> element and Slings returns the IOError event. After some investigations I
> found that the Sling tries to create a property with name "{}Filename",
> which is actually sent from the Adobe flash player. If I try to upload a
> file into the nt:unstructured node everything is OK, but the file did not
> stands as a nt:file. There is an another issue that can produce IOError
> event. The Flash player in Firefox did not send the authentication
> parameters from the cookie. There are some workarounds that can fix this
> issue, so my problem is not in the authentication.
> After that I decide to make a PUT call to the Sling, but it turned out that
> the browser's flash player did not support PUT HTTP Request. So the next
> step that I decide to do is to produce my own PostOperationServlet which can
> do the actual nt:file creation from custom HTTP POST request. I am almost
> done but just in case I decide to ask you about the other possibility which
> can do the browser based Adobe Flex upload to Sling.

Sure, a custom PostOperation would solve your problem, but if you want
a more generic solution, you could probably do it with a servlet
filter, which examines POST requests and filters out dubious field
names.

-- 
Vidar S. Ramdal <vi...@webstep.no>
Webstep AS - http://www.webstep.no
Besøksadresse: Lilleakerveien 8, 0283 Oslo
Postadresse: Postboks 272 Lilleaker, 0216 Oslo