Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 47528 invoked from network); 9 Feb 2006 06:30:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Feb 2006 06:30:33 -0000 Received: (qmail 59875 invoked by uid 500); 9 Feb 2006 06:30:27 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 59825 invoked by uid 500); 9 Feb 2006 06:30:27 -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 59808 invoked by uid 99); 9 Feb 2006 06:30:27 -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 22:30:27 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of mfncooper@gmail.com designates 64.233.162.201 as permitted sender) Received: from [64.233.162.201] (HELO zproxy.gmail.com) (64.233.162.201) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2006 22:30:26 -0800 Received: by zproxy.gmail.com with SMTP id 13so97917nzn for ; Wed, 08 Feb 2006 22:30:05 -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:references; b=MX6TOKzoRUuo28eNcGpEXlXA4lCpz6P1jjFXZci7/Huw6MAeJBs+a2Y5aUyUKaAlNolhAujJeE4ATaumaAxrwVpBpwKe6duoSXawYSR5wPHZExcMbyaFMz1XCNU/iQXWtay/nOwGEAVTfS0kaWHlzvazkq3ti0HfFwzObJ+sAok= Received: by 10.65.154.20 with SMTP id g20mr2150694qbo; Wed, 08 Feb 2006 22:29:56 -0800 (PST) Received: by 10.65.98.2 with HTTP; Wed, 8 Feb 2006 22:29:56 -0800 (PST) Message-ID: <16d6c6200602082229u43509273rf532aac650d7e61f@mail.gmail.com> Date: Wed, 8 Feb 2006 22:29:56 -0800 From: Martin Cooper Sender: mfncooper@gmail.com To: Jakarta Commons Users List Subject: Re: Many attachments, one name In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_2259_22102078.1139466596730" 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 ------=_Part_2259_22102078.1139466596730 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 2/8/06, Greg Evetts wrote: > > 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. Sorry, yes, you're right. Please file a bug report in Bugzilla to make sure this doesn't get lost. 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. Yes please. That would be very helpful. Thanks! -- Martin Cooper -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 lin= e > > > [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 > only > > 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, s= o > 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 > so > > hasn't had much attention paid to it. Can you tell me how you generated > the > > 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 > > ------=_Part_2259_22102078.1139466596730--