• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
multipart upload become garbage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

multipart upload become garbage


  • Subject: multipart upload become garbage
  • From: Yung-Luen Lan <email@hidden>
  • Date: Thu, 16 Sep 2010 07:14:42 +0800

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

  • Follow-Ups:
    • Re: multipart upload become garbage
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Handling just-in-time login - alternative title: dimmer than a very dim thing
  • Next by Date: Re: multipart upload become garbage
  • Previous by thread: Re: Cocoa WebObjects Integration
  • Next by thread: Re: multipart upload become garbage
  • Index(es):
    • Date
    • Thread