Hi, thank you for explanation!

Unfortunately, I'm not using a WOComponent to invoke the DirectAction. This
DA is intended to be used from an Android App for uploading a Signature to
the PDF generated.

Thank you, anyway!

Daniele



2014-03-24 14:20 GMT+01:00 Aaron Rosenzweig <aa...@chatnbike.com>:

> You need to read the docs on WOFileUpload but here is a rough example:
>
> upload : WOFileUpload {
> filePath = fileName;
> bufferSize = 2000;
> size = 20;
>  outputStream = byteArray;
> }
>
>     // variables for the data displayed on screen, submitted into the form
>     public String fileName;
>
> public ByteArrayOutputStream byteArray = new ByteArrayOutputStream(1024*1024);
>
> I think “filePath” is somehow mandatory even if you don’t use it.
>
> Basically you are dealing with a component that has been extended over the
> years (by Apple) that has grown up and worked around some problems in the
> early days of the web. In the original HTML 1.0 days I think you really
> only could have 1 image and it must be last. But with a newer parser and
> some more maturity, it is possible to stream any number of large binary
> files and in any order if you “stream” them. That’s about the best I can do
> for a brief answer that is not entirely factual but relatively close to the
> truth.
>   *Aaron Rosenzweig* / Chat 'n Bike <http://www.chatnbike.com>
> *e:*  aa...@chatnbike.com  *t:*  (301) 956-2319   [image: Chat 'n Bike]  
> [image:
> Chat 'n Bike]
>
> On Mar 24, 2014, at 9:09 AM, Daniele Corti <ilde...@gmail.com> wrote:
>
> Thank You Aaron!
> As you said, the Image must be the last paraments in request, I simply
> change the parameters order and the datas are correctly passed.
>
> Just, one thing: you said "To get around that you can use the streaming
> api.". Do you have a link to docs or to examples of usage for Streaming
> API?
> I've tried to google it or search on wocommunity portal, but I haven't
> found what are you talking about...
>
> Thank You!
>
> Daniele
>
>
> 2014-03-24 13:53 GMT+01:00 Aaron Rosenzweig <aa...@chatnbike.com>:
>
>> Hi Daniele,
>>
>> I don’t believe it is so much a “Direct Action” versus “Component Action”
>> issue.
>>
>> It’s more like the way WO handles that kind of fileUpload image data. By
>> default, the normal ways with NSData on the back, you can only have one
>> binary image like that and it must be last. To get around that you can use
>> the streaming api.
>>
>> Cheers,
>>   *Aaron Rosenzweig* / Chat 'n Bike <http://www.chatnbike.com/>
>> *e:*  aa...@chatnbike.com  *t:*  (301) 956-2319   [image: Chat 'n Bike]  
>> [image:
>> Chat 'n Bike]
>>
>> On Mar 24, 2014, at 8:17 AM, Daniele Corti <ilde...@gmail.com> wrote:
>>
>> Hi,
>> I've preparing a Direct Action for upload a Picture and generate a PDF
>> with it inside.
>>
>> I send two other parameters in POST: wosid, in order to load the session
>> where the user is logged in, and the PK of a Table, in order to load the
>> data for the PDF.
>>
>> I'm trying in Debug mode, and I can upload the Picture, but, except for
>> the com.webobjects.appserver._private.WOInputStreamData with the image
>> datas, no other parameter is passed to the direct action.
>>
>> I've tried to print the result of request().formValues() in the Direct
>> Action, and the result is:
>> {Signature =
>> (<class com.webobjects.appserver._private.WOInputStreamData (stream
>> com.webobjects.appserver.WOMultipartIterator$WOFormData$_WOFormDataInputStream@d335207of
>>  length 0), has NOT been accessed>);
>>  Signature.mimetype = ("image/png");
>> Signature.filename = ("Senzanome.png");
>> }
>>
>> Looking with the firebug in the request I send the datas:
>>
>> POST:
>> -----------------------------13870208907251100452102313237 
>> Content-Disposition:
>> form-data; name="Signature"; filename="bg-movie-closer.png" Content-Type:
>> image/png ‰PNG ���
>> ...(Other Datas from Image)
>>
>> 'Éé—ó ����IEND®B`‚
>> -----------------------------13870208907251100452102313237 
>> Content-Disposition:
>> form-data; name="wosid" flB2bNYt7JdfAxsvtIbtpw
>> -----------------------------13870208907251100452102313237 
>> Content-Disposition:
>> form-data; name="Stabilimento" 85
>> -----------------------------13870208907251100452102313237 
>> Content-Disposition:
>> form-data; name="send"
>>  -----------------------------13870208907251100452102313237--
>>
>> So it seems to me, that I'm sending the form datas.
>>
>> In session construct I set: setStoresIDsInURLs(false);
>> setStoresIDsInCookies(false); no other changes.
>>
>> Do you know, if it is not possible to send multipart data through direct
>> action?
>> Thanks in advance!
>> --
>> Daniele Corti
>> --
>> I DON'T DoubleClick
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>>
>> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
>>
>> This email sent to aa...@chatnbike.com
>>
>>
>>
>
>
> --
> Daniele Corti
> --
> I DON'T DoubleClick
>
>
>


-- 
Daniele Corti
--
I DON'T DoubleClick
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to