Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 8777 invoked from network); 11 Oct 2008 13:25:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Oct 2008 13:25:15 -0000 Received: (qmail 80135 invoked by uid 500); 11 Oct 2008 13:25:12 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 80069 invoked by uid 500); 11 Oct 2008 13:25:11 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 80058 invoked by uid 99); 11 Oct 2008 13:25:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2008 06:25:11 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_HELO_PASS,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.208.4.196] (HELO mout.perfora.net) (74.208.4.196) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2008 13:24:06 +0000 Received: from MysticLake (c-68-40-167-222.hsd1.mi.comcast.net [68.40.167.222]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MKp8S-1KoeS13W56-0001n1; Sat, 11 Oct 2008 09:24:11 -0400 Reply-To: From: "F. Andy Seidl" To: "'Commons Users List'" References: <8fbbf6ce0809300701w7c04d188hf89414c1546fe887@mail.gmail.com> <5A8E8B5207324B77B61AAB05F89A2383@MysticLake> <8fbbf6ce0809300952m3526d3bale1a01b72b4a0a6b8@mail.gmail.com> <16d6c6200809300956q7e863580oca524cb65ea4f4a@mail.gmail.com> <8fbbf6ce0810010642p2e11a985wc89329b9ec7c354@mail.gmail.com> Subject: RE: fileupload sizelimitexception Date: Sat, 11 Oct 2008 09:24:09 -0400 Organization: MyST Technology Partners, Inc. Message-ID: <5B7F0A75797E403FB861057CE3FB29D8@MysticLake> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <8fbbf6ce0810010642p2e11a985wc89329b9ec7c354@mail.gmail.com> Thread-Index: Ackjy6whmfEv5CbcQRiPdafXu1EhNAH2FFtA X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Provags-ID: V01U2FsdGVkX19raEmigncX8rZAimneUDiXJ3Y1hn0PdF2D2rV MgdmIEDBWD6PGtjBkdN+kSRw0S70rlMn35UgV6oQUB15pnapoc wwf5GF+xnf15M/Js3vtvtYCBLh2nFSEsifrREPNa3U= X-Virus-Checked: Checked by ClamAV on apache.org Hi Paul, The problem with putting the hidden field at the end of the form is that it will be sent to your server *after* the other fields. Your server won't physically have the hidden field until after it has read the data of all the other fields, which is too late. In other words, you can never access data send *after* the file content without reading all the file content since the input stream is a not a random access beast. It seems to me that to ensure you see the hidden field you must either a) move the hidden field ahead of the other fields or b) read the entire file content, regardless of its size. -- fas -----Original Message----- From: Paul Rivera [mailto:paulrivera22@gmail.com] Sent: Wednesday, October 01, 2008 9:43 AM To: Commons Users List Subject: Re: fileupload sizelimitexception Thanks for the info! The hidden field that I need is located just before the end tag of my form. Relocating it to some part in the beginning will be tough. It will probably be a last resort. I'm wondering if: - I could still retrieve all my form fields even though I exceed the size limit (including parameters before and after my file upload field) - even better if I can skip reading the file since its size is already not acceptable and read only my field parameters from my web app. Thus saving some time by not waiting for the upload to complete. Best Regards, Paul Rivera On Wed, Oct 1, 2008 at 12:56 AM, Martin Cooper wrote: > On Tue, Sep 30, 2008 at 9:52 AM, Paul Rivera > wrote: > > > Hi! > > > > Thanks for the quick response. > > > > Yes, I have. Sorry for the vagueness but let me clear things up a > little. > > > > FileUploadBase.parseRequest() returns a List containing FileItem objects. > > These FileItem objects can either be a file uploaded or a form field > (these > > form fields are what I need). > > > > In commons fileupload 1.0, FileUploadBase.parseRequest() throws an > > Exception > > if the maxSize is exceeded _before it even starts to read from the > > MultipartStream. Meaning, it will not even read the first form field. > > > > I've looked into fileupload 1.2.1 and the flow looks pretty much the > same. > > > If you use the streaming mode in 1.2, you should be able to capture the > hidden field before you hit the max size limit. > > -- > Martin Cooper > > > I was hoping I could make FileUploadBase.parseRequest() still return the > > form fields (but exclude the data from the uploaded file) even in the > case > > when the maxSize is exceeded. > > > > Any ideas? > > > > Best Regards, > > Paul Rivera > > > > On Tue, Sep 30, 2008 at 11:36 PM, F. Andy Seidl < > > faseidl@myst-technology.com > > > wrote: > > > > > Have you tried placing the hidden form field before the upload field in > > the > > > form? > > > -- fas > > > > > > -----Original Message----- > > > From: Paul Rivera [mailto:paulrivera22@gmail.com] > > > Sent: Tuesday, September 30, 2008 10:02 AM > > > To: user@commons.apache.org > > > Subject: fileupload sizelimitexception > > > > > > Hi! > > > > > > I'm using commons fileupload 1.0. I'm in a situation wherein: > > > > > > - if the user submits a file larger than my defined maxFileSize, > > > FileUploadBase throws a SizeLimitExceededException which stops > processing > > > of > > > the remaining parameters. > > > - i have a hidden field in my form that my web application needs to > > > retrieve even in the case of an exceeded size limit. > > > > > > Does anyone have ideas on possible solutions here? > > > > > > I have not yet tried using the latest release, > commons-fileupload-1.2.1. > > > But skimming through the code, things look similar. It looks like the > > > exception will still be thrown before the rest of the parameters get > > read. > > > > > > Best Regards, > > > Paul Rivera > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org > > > For additional commands, e-mail: user-help@commons.apache.org > > > > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org