Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 53918 invoked from network); 8 Feb 2006 19:07:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Feb 2006 19:07:55 -0000 Received: (qmail 70655 invoked by uid 500); 8 Feb 2006 19:07:48 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 70616 invoked by uid 500); 8 Feb 2006 19:07:48 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 70605 invoked by uid 99); 8 Feb 2006 19:07:48 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 11:07:48 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of greg.evetts@gmail.com designates 64.233.184.196 as permitted sender) Received: from [64.233.184.196] (HELO wproxy.gmail.com) (64.233.184.196) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 11:07:47 -0800 Received: by wproxy.gmail.com with SMTP id 69so120215wri for ; Wed, 08 Feb 2006 11:07:26 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CJoRumzdp4vYEPN6vF1yVimxLTxciWam7+64Ltkk+7Zrk89cPmHNNp4+cV2ou1A7jCn3tf3W0H+xXyG2o/Zon53a0LeT/azUZw6tEwIIwnJAk+xaGi/vn17dzf01x31NOp/HXlwB+kLUnWajHWlgxoudOmnrYymWAJFonW0lBvY= Received: by 10.64.183.9 with SMTP id g9mr1590795qbf; Wed, 08 Feb 2006 11:07:25 -0800 (PST) Received: by 10.65.11.13 with HTTP; Wed, 8 Feb 2006 11:07:25 -0800 (PST) Message-ID: Date: Wed, 8 Feb 2006 13:07:25 -0600 From: Greg Evetts Sender: greg.evetts@gmail.com To: Jakarta Commons Users List Subject: Re: Many attachments, one name In-Reply-To: <16d6c6200602081033n93ba881p8b86a27e01529988@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <16d6c6200602081033n93ba881p8b86a27e01529988@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N It seems to me that the bug is the failure to persist the field name ("pics" in this example) and apply it to subsequent attachments within this multipart/mixed segment. I think that to overload the "filename" by giving it "field name" semantics is incorrect. To answer your question regarding the client-side, I've written an applet generates the request. I can send you the source if you're interested. -Greg Evetts On 2/8/06, Martin Cooper wrote: > On 2/8/06, Greg Evetts wrote: > > > > I'm having a problem parsing this example multipart request from RFC > > 1867. It appears that the attachmements "file1.txt" and "file2.gif" > > are associates with the same form field name, "pics". However, since > > the name "pics" is specified in the content-disposition header on line > > [08], it is lost when the content-disposition header on line [12] is > > parsed. The attachment is returned in the FileItem but the fieldName > > property is null. > > > There are two separate issues here. The first is that FileUpload will onl= y > retain the name of individual items, and not the collective name given to > multipart/mixed data, so you should not expect "pics" to show up anywhere= in > the results. The second issue is that FileUpload is not picking up the > filename from an attachment as the field name. That's probably a bug, so = it > would be good if you could file a bug report against it in Bugzilla. > > To be honest, the whole multipart/mixed thing hardly ever comes up, and s= o > hasn't had much attention paid to it. Can you tell me how you generated t= he > request that you're trying to parse? > > -- > Martin Cooper > > > [01] Content-type: multipart/form-data, boundary=3DAaB03x > > [02] > > [03] --AaB03x > > [04] content-disposition: form-data; name=3D"field1" > > [05] > > [06] Joe Blow > > [07] --AaB03x > > [08] content-disposition: form-data; name=3D"pics" > > [09] Content-type: multipart/mixed, boundary=3DBbC04y > > [10] > > [11] --BbC04y > > [12] Content-disposition: attachment; filename=3D"file1.txt" > > [13] Content-Type: text/plain > > [14] > > [15] ... contents of file1.txt ... > > [16] --BbC04y > > [17] Content-disposition: attachment; filename=3D"file2.gif" > > [18] Content-type: image/gif > > [19] Content-Transfer-Encoding: binary > > [20] > > [21] ...contents of file2.gif... > > [22] --BbC04y-- > > [23] --AaB03x-- > > > > Here's the code I'm using to parse the request: > > > > [01] final FileItemFactory factory =3D new DiskFileItemFactory(1024, > > TMPDIR); > > [02] final ServletFileUpload upload =3D new ServletFileUpload(factory); > > [03] > > [04] upload.setSizeMax(1 << 22); // 4MB > > [05] > > [06] final List items =3D upload.parseRequest(request_); > > [07] > > [08] for (final FileItem fi : items) { > > [09] final String name =3D fi.getFieldName(); > > [10] ... > > [11] } > > > > Any help is appreciated. > > -Greg Evetts > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: commons-user-help@jakarta.apache.org > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org