Re: multipart upload become garbage
Re: multipart upload become garbage
- Subject: Re: multipart upload become garbage
- From: Chuck Hill <email@hidden>
- Date: Wed, 15 Sep 2010 17:25:54 -0700
I'd expect that this is a bug in the WO Adaptor or in WO. It could possibly be a bug in Java or Apache, but that seems less likely. I'd suggest trying an update to WO 5.4.3 which has bug fixes for problems in 5.4.2.
Chuck
On Sep 15, 2010, at 4:14 PM, Yung-Luen Lan wrote:
> Hi,
>
> The following code receives one chunk of multipart uploads and
> appending it to a file.
> (I have a client app which split the file first and then send the
> chunks one by one.)
> However, I got trouble when I deploy the code to a snow leopard
> machine. I found the file uploaded is not the same as the original
> file.
>
> It seems that if there is byte '\0' occurred in the upload stream, the
> succeeding bytes all becomes zero.
> But this code used to work on both my old server (10.5, WO 5.4.2, Java
> 1.6 32bit) and dev machine (10.6, WO 5.4.2, Java 1.6 64bit)
>
> What could possibly get wrong?
>
> Regards,
> yllan
>
> =====
> try {
> WORequest r = context().request();
> WOMultipartIterator iterator = r.multipartIterator();
> WOMultipartIterator.WOFormData data = null;
> NSData fileData = null;
>
> while ((data = iterator.nextFormData()) != null) {
> if (data.isFileUpload()) {
> try {
> InputStream stream = data.formDataInputStream();
> fileData = new NSData(stream, 4096);
> } catch (Exception e) {
> return makeErrorXMLResponse(n, "UPLOAD: Failed to read Data from Stream.");
> }
> }
> }
>
> if (fileData == null)
> return makeErrorXMLResponse(n, "UPLOAD: Failed to read data from request.");
>
> fileData.writeToStream(session().pdfStream());
> } catch (Exception e) {
> return makeErrorXMLResponse(n, "UPLOAD: " + e.toString());
> }
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden