Upload file attachment to S3

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Upload file attachment to S3

Karthi
Hi,

I am using latest form builder to design the form and integrated with our application using Orbeon 'server side embedding API'.

I have a requirement to store a file that is uploaded from the integrated Orbeon form's file attachment control to AWS-S3. How should I approach for this ?

Thanks in advance.
-- Karthi
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Alessandro  Vernet
Administrator
Hi Karthi,

Are you using on the built-in implementation of the persistence API? If you are, for which database? And you're saying that you'd like all the data to go to the regular place, except for the attachments you want on AWS S3? Is this in addition or instead of being in the regular database?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Karthi
Hi Alex,

We are not using database for form data storage, but  the form data is submitted as XML via callback (Orbeon 'submit' process) to our application and our application takes care of storing form data XML.

In this scenario, we wanted to decrease the submitted Orbeon XML model size by not having the attachment as part of the XML (I tried embedding the attachment as inline BASE64 content, but the XML size was too big). So whenever a document is Ajax uploaded from the form, it should be submitted to our application and our application will manage the uploaded attachments.

Please let me know if you need more details.

Thanks
Karthi
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Karthi
In reply to this post by Karthi
To add on to my previous reply, it is OK if the uploaded document is duplicated in Orbeon before it callback one of the services
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Karthi
Hi Alex,

As a work around, from form builder, I have created a Orbeon HTTP service that POSTs 'temporary folder file URL' (like file:/c:/temp/autogeneratedfilename.tmp?filename=test.xml&mediatype=text/xml&mac=autogenerated) to our service and our service reads this file and uploads to S3 and the result is sent as XML to Orbeon.

Should this be fine?

One issue with this is that the next time when the same form is opened for edit, i need to show the previously stored attachments -- in which case, Orbeon should call back our service for loading the document attachment.

Should this be possible?

Please let me know.

Thanks,
Karthi
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Alessandro  Vernet
Administrator
Hi Karthi,

So you're saying that you're currently not using the Form Runner persistence itself, but instead have Form Runner submit the data to a service of yours, which deals with the data on its own. And I understand you don't want the data to be embedded in the XML as base64.

In this case, I think I would have Form Runner save the data in its own persistence, even if you don't care about it as a form or "long-term" storage, but this way, in the XML your service receives, in the elements for file attachments, you'll have a URL pointing back to the Orbeon Forms persistence API, which your service can go fetch right away to save the file wherever it sees fit. Would this be something that could work for you?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Karthi
Hi Alex,

Yes that's what I am expecting.
Should that be possible to configure persistence only for the file attachments?
Please let me know

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Alessandro  Vernet
Administrator
Hi Karthi,

You can't configure Form Runner to only save files through the persistence API. But saving the XML documents as well, even if you don't use them, shouldn't really create any problem in your case.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Upload file attachment to S3

Alessandro  Vernet
Administrator
And for reference, this is the relevant issue:

https://github.com/orbeon/orbeon-forms/issues/788

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet